Netlify Site Name: overcomer.netlify.app
Hello,
I am using Next.JS to create a webhook listener for Snipcart.
I noticed that when I hit the endpoint, the headers that were send are not present and I really need a specific token header to validate the webhook call, but it seems to disappear when it reach the endpoint.
Here is the function URL: https://overcomewithchrist.com/.netlify/functions/next_api_snipcart
Here is the header example for a call:
X-Forwarded-For: 10.87.180.33
X-Snipcart-Purpose: Webhooks
X-Http-Method-Override: POST
*X-Snipcart-RequestToken*: 7cab64cf-f741-4ecc-908e-0964f161fff7
I really need the X-Snipcart-RequestToken to be available. Here are the logs from hitting the endpoint using Postman and Snipcart:
6:40:32 PM 2022-01-05T00:40:32.953Z undefined INFO Loaded env from .env
6:40:32 PM a9eabfd0 INFO [request] /api/snipcart
6:40:32 PM a9eabfd0 INFO {"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","accept-encoding":"br","client-ip":"100.64.0.62","connection":"keep-alive","forwarded":"for=54.165.144.195;proto=https","sec-fetch-dest":"document","sec-fetch-mode":"navigate","sec-fetch-site":"none","sec-fetch-user":"?1","upgrade-insecure-requests":"1","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/91.0.4472.114 Safari/537.36 Prerender (+https://github.com/prerender/prerender)","via":"http/1.1 Netlify[ebbcbd64-1560-4314-b9e3-504151193e62] (Netlify Edge Server)","x-bb-ab":"0.745641","x-bb-client-request-uuid":"01FRKTWA95W752TNB0VXJHEQ66","x-bb-ip":"54.165.144.195","x-bb-loop":"1","x-cdn-domain":"www.bitballoon.com","x-country":"US","x-datadog-parent-id":"747442037802369116","x-datadog-sampling-priority":"1","x-datadog-trace-id":"17439331054613234698","x-forwarded-for":"54.165.144.195, 100.64.0.62","x-forwarded-proto":"https","x-nf-cdn-host":"cdn-reg-aws-jfk-10","x-nf-cdn-region":"jfk","x-nf-client-connection-ip":"54.165.144.195","x-nf-connection-proto":"https","x-nf-forwarded-proto":"https","x-nf-request-id":"01FRKTWA95W752TNB0VXJHEQ66","x-nf-request-start":"1641343232293657347","host":"overcomewithchrist.com","x-forwarded-host":"overcomewithchrist.com"}
6:40:32 PM a9eabfd0 INFO Starting webhook call. tkn: undefined
6:40:33 PM a9eabfd0 INFO Webhook call was not successfully authenticated.
6:40:33 PM a9eabfd0 Duration: 138.23 ms Memory Usage: 69 MB Init Duration: 297.94 ms
6:59:47 PM 2022-01-05T00:59:47.617Z undefined INFO Loaded env from .env
6:59:47 PM 03b0fff0 INFO [request] /api/snipcart
6:59:47 PM 03b0fff0 INFO {"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","accept-encoding":"br","client-ip":"100.64.0.9","connection":"keep-alive","forwarded":"for=35.153.36.40;proto=https","sec-fetch-dest":"document","sec-fetch-mode":"navigate","sec-fetch-site":"none","sec-fetch-user":"?1","upgrade-insecure-requests":"1","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/91.0.4472.114 Safari/537.36 Prerender (+https://github.com/prerender/prerender)","via":"http/1.1 Netlify[ed76a6c8-e4b6-4716-b050-f6560a07914f] (Netlify Edge Server)","x-bb-ab":"0.691241","x-bb-client-request-uuid":"01FRKVZHNDF5M9J7KB03P0M4Y1","x-bb-ip":"35.153.36.40","x-bb-loop":"1","x-cdn-domain":"www.bitballoon.com","x-country":"US","x-datadog-parent-id":"7369284433694139759","x-datadog-sampling-priority":"1","x-datadog-trace-id":"11589551373876637303","x-forwarded-for":"35.153.36.40, 100.64.0.9","x-forwarded-proto":"https","x-nf-cdn-host":"cdn-reg-do-jfk-22","x-nf-cdn-region":"jfk","x-nf-client-connection-ip":"35.153.36.40","x-nf-connection-proto":"https","x-nf-forwarded-proto":"https","x-nf-request-id":"01FRKVZHNDF5M9J7KB03P0M4Y1","x-nf-request-start":"1641344386733935437","host":"overcomewithchrist.com","x-forwarded-host":"overcomewithchrist.com"}
6:59:47 PM 03b0fff0 INFO Starting webhook call. tkn: undefined
6:59:47 PM 03b0fff0 INFO Webhook call was not successfully authenticated.
6:59:47 PM 03b0fff0 Duration: 138.99 ms Memory Usage: 69 MB Init Duration: 314.16 ms
7:17:38 PM 2022-01-05T01:17:38.828Z undefined INFO Loaded env from .env
7:17:38 PM 87181aac INFO [request] /api/snipcart
7:17:38 PM 87181aac INFO {"accept":"*/*","accept-encoding":"br","client-ip":"100.64.0.243","connection":"keep-alive","content-length":"10086","content-type":"application/json","forwarded":"for=71.135.69.58;proto=https","postman-token":"0e4fd953-fd50-4533-bac7-c5006e9db948","user-agent":"PostmanRuntime/7.28.4","via":"http/1.1 Netlify[78a8ba06-084b-49af-8dce-8a37fc97921b] (Netlify Edge Server)","x-bb-ab":"0.559499","x-bb-client-request-uuid":"01FRKX07S83TKN9NKBGYZ4ERYM","x-bb-ip":"71.135.69.58","x-bb-loop":"1","x-cdn-domain":"www.bitballoon.com","x-country":"US","x-datadog-parent-id":"965807999649079289","x-datadog-sampling-priority":"1","x-datadog-trace-id":"9336536725464760778","x-forwarded-for":"10.87.180.33, 71.135.69.58, 100.64.0.243","x-forwarded-proto":"https","x-http-method-override":"POST","x-nf-cdn-host":"cdn-reg-aws-jfk-14","x-nf-cdn-region":"jfk","x-nf-client-connection-ip":"71.135.69.58","x-nf-connection-proto":"https","x-nf-forwarded-proto":"https","x-nf-request-id":"01FRKX07S83TKN9NKBGYZ4ERYM","x-nf-request-start":"1641345457960919990","x-snipcart-purpose":"Webhooks","x-snipcart-requesttoken":"2800003f-0380-457a-b9b8-9f7c558c68e9","host":"overcomewithchrist.com","x-forwarded-host":"overcomewithchrist.com"}
7:17:38 PM 87181aac INFO Starting webhook call. tkn: undefined
7:17:38 PM 87181aac INFO Webhook call was not successfully authenticated.
7:17:38 PM 87181aac Duration: 139.88 ms Memory Usage: 69 MB Init Duration: 330.63 ms
7:32:08 PM [ERROR] Function logs are currently unavailable. We are working on resolving the issue.
For each of the calls, the logged header did not have the request header I need. I am not sure how I should go about getting this header to be present correctly.
Let me know if I need to provide more information.
Thank you for your help.