hookdeck / hookdeck-vercel

Authenticate, delay, filter, queue, throttle, and retry asynchronous HTTP requests (e.g., webhooks) made to a Vercel application via a middleware integration with Hookdeck
Apache License 2.0
30 stars 1 forks source link

Using middleware locally results in Error: unable to verify the first certificate error when publishing to Hookdeck #8

Closed leggetter closed 5 months ago

leggetter commented 5 months ago

More details to follow.

If you make a request to your local application endpoint, the middleware intercepts the request but you get the following error:

[Hookdeck] Forwarding to hookdeck (with body)... {
  method: 'POST',
  headers: {
  accept: '*/*',
  accept-encoding: 'gzip, deflate, br',
  connection: 'close',
  content-length: '23',
  content-type: 'application/json',
  host: 'localhost:3000',
  postman-token: '7babf223-cf53-40a0-8f48-c79ec77db6e2',
  user-agent: 'PostmanRuntime/7.37.3',
  x-forwarded-for: '::1',
  x-forwarded-host: 'localhost:3000',
  x-forwarded-port: '3000',
  x-forwarded-proto: 'http',
  authorization: 'Bearer {TOKEN}',
  x-hookdeck-source-name: 'vercel-527074e1c'
},
  body: '{\n    "test": "value"\n}'
}
[Hookdeck] Exception on withHookdeck  [TypeError: fetch failed] {
  cause:  [Error: unable to verify the first certificate] {
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
}

I've tested using the bearer {TOKEN} in a direct request to the publish endpoint and the request succeeds.

jmnavarro commented 5 months ago

This is the first time I saw it. It seems that it's failing doing post to the /publish endpoint.

Is it still happening? Can you share your Vercel project with me?

leggetter commented 5 months ago

@jmnavarro it's this one https://github.com/hookdeck/hookdeck-vercel-example

I'm making a request to the local endpoint and then it fails on the call to the publish endpoint, as you said.

jmnavarro commented 5 months ago

Oh! TBH I didn’t try the local development experience!

leggetter commented 5 months ago

@alexbouchardd how and where has this been resolved?

alexbouchardd commented 5 months ago

The middleware should be skipped locally since the lastest set of changes cc @jmnavarro

jmnavarro commented 5 months ago

@leggetter it was done here https://github.com/hookdeck/hookdeck-vercel/pull/11