#Elswell

1 messages · Page 1 of 1 (latest)

celest questBOT
wintry oyster
#

Hey, are you available?

smoky grail
#

hey there, sorry for the delay

#

Yes can you please share any code snippets you're using for your webhook endpoint?

#

And what have you learned so far from debugging this?

wintry oyster
#

This is the endpoint code

#

There is something weird that i came across but for some reason I didn't pay much attention. While I was running stripe listen --forward-to localhost:3000/api/webhook in the stripe cli, and at the same time completing purchases on the vercel deploy, everything was magically working

#

Or I could have been losing my mind, which is completely possible

smoky grail
#

Your signature verification was working while testing locally with forwarding?

wintry oyster
#

I think so, because the database was getting updated

#

when the verification failes, the db doesnt get touched

smoky grail
#

have you verified the header you extract has a value? ie, logging some samples of signature to confirm it hasn't been wiped at some point

wintry oyster
#

Yes, I was just about to say that

#

When I log it out locally i can see the timestamp and some more data after it

#

i had a screenshot somewhere

smoky grail
#

Yea that sounds like the expected value. What about the live deployment logs?

wintry oyster
#

I will do a quick test on that again, I can't find the console.logs in the live logs on vercel

#

it only shows me the 400 code errors from the failed verification

smoky grail
#

You'll need to get access to those logs, but I'm not sure how to do that off the top of my head using vercel

wintry oyster
#

Give me like 5 minutes max

#

i did try logging req.headers, and there seems to be a weird empty log

#

Could it be because I am passing the body in a wrong way?

#

I am currently using raw-body to parse it, and I have also set bodyParser to false in the nextjs config

#

Ok i got the logs

smoky grail
#

That seems to be the wrong header value

wintry oyster
#

this is the log of req.headers

#

so yeah, the signature is completely messed up

smoky grail
#

I can't really help with Vercel config though sadly

#

but thats the path to pursue

#

You need that header value