#victoria.fabris - webhook 500

1 messages ยท Page 1 of 1 (latest)

upper dock
#

Have you checked your server logs to see if any internal errors are being thrown by your webhook endpoint code?

#

And do you know about how long your handler is taking to process these requests? You have about 30 seconds to respond, so if it is taking longer than that, that could be the culprit

forest jackal
#

im receiving this

#

when i just take out the pieces of code that takes an action depending on the event type, this happens

upper dock
#

Can you step through the code that you have commented out and see if an error is thrown?

#

Server libraries often respond with 500s if there is an uncaught error in your code

forest jackal
#

ok, im going to do some checks along the code to see if some error is thrown

#

maybe im getting some error trying to get the subscription id throug the event

lunar nexus
#

Hello ๐Ÿ‘‹
Taking over for Pompey here as they need to step
Yeah, that would cause the code to throw 500

forest jackal
#

in python, is this the right way to do that?

#

im constructing the event with the stripe.Webhook.construct_event

#

and then im doing

lunar nexus
#

can you try printing it out before you access the properties?

forest jackal
#

print the event?

lunar nexus
#

I'd start from event.data and then .object and then the .id

forest jackal
#

ok, im gonna do that

#

ok, so now that i correct the way i was getting the subscription id from the event, i still receiving some 500 error

#

i took out the piece of code where i send a push notification to the user, and then i received a http 200

lunar nexus
#

Cool. So seems like the push notification is causing this 500.

forest jackal
#

i receive a 500 and then a 200

#

is this right?

forest jackal
lunar nexus
#

I still do see some 500s
You'd likely want to test one line at a time and make sure it isn't throwing any exceptions

forest jackal
#

ok, going to do that

#

thank you in advance, i see that im going to find this error!

lunar nexus
#

NP! ๐Ÿ™‚ Good luck