#FeZEC

1 messages ยท Page 1 of 1 (latest)

patent juniperBOT
fringe quail
#

Hey there

rich narwhal
#

Hi

fringe quail
#

So a 500 error here means your server isn't receiving the Webhook

#

So you want to debug your endpoint here

#

Are you testing locally and forwarding via the CLI? Or are you on a live server?

rich narwhal
#

FWDing with CLI

#

i receive the event in my application

#

but the signature always fails

fringe quail
#

Ah okay that's a bit different then

#

Shouldn't really be a 500 then unless you are having your server send back a 500, which is a bit strange.

#

Can you share your webhook code?

rich narwhal
#

sure

#

payload = request.body.read
sig_header = request.env['HTTP_STRIPE_SIGNATURE']
event = nil
begin
event = Stripe::Webhook.construct_event(
payload, sig_header, endpoint_secret
)
rescue JSON::ParserError => e
# Invalid payload
status 400
return
rescue Stripe::SignatureVerificationError => e
# Invalid signature
status 400
return
end

head ๐Ÿ†—
#

I've removed the endpoint_sercret

#

but its definitely the one thats provided by the cli

fringe quail
#

So you are seeing a 400 for invalid signature? Or you are getting a 500 back?

rich narwhal
#

"status": 500,
"error": "Internal Server Error",
"exception": "#<ArgumentError: wrong number of arguments (given 1, expected 0)>",

#

this is what is being thrown

#

which accounts for the 500.. this issue stems from the signature check

#

{
"status": 500,
"error": "Internal Server Error",
"exception": "#<ArgumentError: wrong number of arguments (given 1, expected 0)>",
"traces": {
"Application Trace": [
{
"exception_object_id": 41300,
"id": 1,
"trace": "app/controllers/stripe_controller.rb:24:in `rescue in notify'"

#

just a bit more context of the error

fringe quail
#

Can you log out your payload, sig_header, endpoint_secret before Stripe::Webhook.construct_event and share the logs?

rich narwhal
#

yeah 1 moment

#

sig_header=t=1667503292,v1=99317409c64e4e696f541129ece2fa4b5218c0cadb76135aecc2f5f6a8ae320d,v0=b53cc4e555ceabedf726f2fbcf768f47a003c22d85c1ff27fa9b83da9b757280
endpoint_secret=whsec_59e62cf378dc7380e7e8eed1fbd02212eee877e06cefbda36dd34a67c85d37b7
payload=

#

oddly enough that went through just now.

#

but i did not have any webhook activated any longer

fringe quail
#

Hmm so that most recent test did work?

rich narwhal
#

yes.

#

I'm going try a second one

fringe quail
#

๐Ÿ‘

rich narwhal
#

ok that worked as well. i'm now confused

#

would the cli have a conflict if i did have an enabled webhook to another domain in conjunction to the cli event?

fringe quail
#

The CLI should only forward to wherever you specified

#

But if you have other endpoints registered then any triggered events will also attempt to send to those other endpoints

rich narwhal
#

and the signatures would be different correct? The cli uses the cli provided secret and the webhook would require the dashboard provided secret correct?

fringe quail
#

Correct

rich narwhal
#

ok well as its working now.. i will accept it and try in the next environment.
Thanks so much for your help today bismarck

#

btw the api is fantastic!