Nextjs request's order in async api

I have api endpoint to handle payment webhook requests. So it's multiple requests one by one which changes status of transaction and sometimes mine database updated in a wrong order. How it possible to ensure right order of requests in nextjs 13 ?
4 Replies
peterkyle01
peterkyle012y ago
Are promises not working,have you tried chaining one after the other
web3moloh
web3molohOP2y ago
i've tried but not really working
web3moloh
web3molohOP2y ago
only if i put sleep for few second it's working but it looks like a bad solution\
peterkyle01
peterkyle012y ago
because you are in the case statement where the case of event is order updated the same event exists down the chain of promises,i think the process is right but its just the console logging that says otherwise because it is the same event at the top
Want results from more Discord servers?
Add your server