I am new to Glitch and webhooks. Working on my first project that involves receiving webhooks from Shopify.
I am having an issue/error, I am not sure where it comes from, I am debugging.
However, I am wondering, what happens if multiple persos buy at the same time? What happens with more than one webhook hitting my app project on Glitch?
if you’re using the usual languages and libraries on Glitch, then you’re writing JavaScript code. the way that works is your app runs only one piece of code at a time, so if multiple webhook requests arrive “at the same time,” they’ll still be processed one by one.
however, you might be writing asynchronous JavaScript code, which allows parts of the code to be split up over time and for those parts to be interleaved. (search around for online resources if you’re not familiar with this.) that interleaving can make it tricky to design programs that work correctly.
so look through places in your code where you use await or callbacks and try to reason through whether they can be incorrect if various other pieces of code run in between those places.
I am indeed using await, because I am sending requests to a couple of web services, so I have to await, I have no option.
I have already found the issue to my problem. It is because a property that I am using, comes null sometimes. It is an issue from the webhook sender (Shopify in this case).
The online shop rarely with have many purchases at the same time, but it could happend, probably, about no more than 4 or 5 at the same time, I guess.
Should I expect issues in that cases? I am using node, js… To me having to wait a little more when multple purchases are being made is not an issue. An issue would be having an error.
since you’ve witnessed it happen, I suppose in that sense you should expect it to happen. are you able to work around it e.g. by getting that piece information some other way, or can you proceed correctly without that information?
but maybe on a longer timescale, if it is indeed a problem with the webhook sender, maybe you can tell them and have them fix it.
this discussion is all pretty vague. what property is it? is it well documented to be not null?
edit: and is there anything from shopify to help you confirm that it is correlated with situations where multiple webhook requests come in at the same time?