Why am I not able to properly track data of webhook?

Why am I not able to properly track data of webhook?

westernY
Shopify Partner
8 0 1

I've met a weird issue today when I was tackling the data of webhook, which you could see below:

westernY_1-1679990967952.png

In this function I called the Graphql to deal with order newly  created, I know this is a little bit verbose, but I can't see any useful information about 'fulfillmentOrders' in body paraphrased as 'payload' in my code, reckoning I need to implement the auto-fulfill function; At this function 'fulfillOrder' as pasted below:

westernY_2-1679991315882.png

and the  function 'conditionsGen' is actually simple implement as a name query, pasted below:

westernY_3-1679991401884.png

the question is when I debug this I could get whole data I concerned through way I pasted below

westernY_4-1679991472586.png


but when I just let it run, things will get terribly wrong as the orders I received will become empty.

I just wonder wether the order data persistence action of 'order/created ' is actually lagging behind the the web hook action, in other words, when shopify shop is created an order, it will send the web hook firstly and then store the data to databse, and so I cannot query anything about this order?

I am thinking about the solution, actually now I want to setTimeOut() to fix this, but it's too graceless for a programmer. 

 

'

Replies 0 (0)