Closed greenstick closed 2 weeks ago
Hi @greenstick
Is this issue for the website (https://hono.dev), right ?
@hideokamoto Can you take a look?
Hi @greenstick
Is this issue for the website (https://hono.dev), right ?
@hideokamoto Can you take a look?
Yes – it's possible that it may also affect Hono if it has something to do with Hono manipulating the raw body.
I finally traced the issue and it wasn't to do with Hono at all. It seems that some trailing whitespace was included when copying and pasting the Stripe Webhook signing secret (i.e. the one that looks like whsec_c29Kb1aXylHno...
) from the Stripe Dashboard to the Supabase Edge Function Secrets Management. Once that was fixed, it worked.
First off, have to say I've really been enjoying working with Hono. It's delivered on everything I've asked of it so far and has done so with ease, with this issue being the only exception (and possibly not due to Hono at all).
The issue
In the Stripe Webhook Example docs, when I use the code as defined, the Stripe Verification function fails. This seems to be an issue with the request
body
, though, the error I get states it's to do with thesignature
(seems the error's a bit coarse – I've verified that there's no trailing whitespace in the signature, debug attempts detailed below). Here's the full error:Attempts to Debug
I've tried a variety of things to get the verification working:
context.req.text()
,context.req.raw.text()
,context.req.body()
.Likely Cause
This seems to be an issue with how Hono is processing the body of the request. If others can get this working in a different runtime, however, it may be that the Deno runtime of Supabase Functions is modifying the body (from what I've seen in my other edge functions, this isn't the case. Still, I haven't completely ruled it out).
All said, how can I get Stripe Webhook Verification working? And is the example in the docs current or does it need to be updated?
Any insights appreciated – thanks!
In case it helps:
Code
Version Information
Relevant entries from
import_map.json
.Webhooks Supabase Edge Function (
index.ts
)Stripe Webhook (
/routes/stripe.ts
)