#jcalentine-webhook-500

1 messages ยท Page 1 of 1 (latest)

waxen solsticeBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

brave fossil
#

Hi ๐Ÿ‘‹ no. If your endpoint is returning a 500 that is usually a sign that the code crashed and you need to debug why.

#

If it happens inconsistently, that likely means you're looking for an edge-case, an unsupported Event type, a race condition, something along those lines.

stray hatch
#

Ok so i will explain exactly what my webhook is doing. Is that ok

#

?

#

If it is a race condition. Should i use the webhook to call functions that update the database independently rather than updating my database with the webhook, and allow a wait within my web application before trying to update the database. I do apologies I just graduated from college and this will be my first encounter with a race condition.

waxen solsticeBOT
unborn onyx
#

๐Ÿ‘‹ hopping in here!

#

Have you narrowed down where the 500 is coming from? I'm not sure what you mean by "use the webhook to call functions that update the database independently" vs "updating my database with the webhook", but as a general rule we usually recommend you immediately respond back to the webhook event from Stripe soon after receiving it (before doing any heavy operations like DB updates)

#

jcalentine-webhook-500

stray hatch
#

I guess what I am trying to ask is: Should i just grab the data I need from the webhook as you said "immediately" and then just work with the data after. I believe i am just doing it all within the view that the webhook communicates with in my application. So I think i need to separate the database operations

unborn onyx
#

Yeah if you're planning to use the data for some heavier/longer-runnign operations then you should do that after sending back the successful response back to stripe

stray hatch
#

basically what I do is when i get the checkout.session.completed, I store all the data and then do the heavy lifting right away so.... Also, my server is on the west-coast and I am on the east, so I am assuming that the latency is probably a small contributer too lol

#

But I am assuming its mostly my fault for not separating the two. But then again I am tackling this web application with no prior experience so this is where I make fun of myself and call myself a junior dev

#

Thank you so much for your help and being patient with me. By the way I know I poorly worded my last question. Please let the other person helping me know that I am sorry if I made them angry

unborn onyx
#

Nah, you were fine - the channel just got really busy so sometimes we take a bit longer between responses

stray hatch
#

Any tips/research I should look into moving forward, regarding this type of problem

unborn onyx
#

Really, your first step is to pinpoint the 500 and make sure you understand the edge case that's resulting int he error on your end