Per productSet documentation, when it runs in async mode, we are supposed to receive an ID and use that to query the status. However, is there a webhook/pubsub for it instead? I’m not sure if bulk_operations/finish
is the correct webhook. If not, it seems that querying productOperation for every product to get the status seems overkill.
Hey @ronald_g
You can use productSet with the bulkOperationRunMutation
. You can then subscribe to the bulk_operations/finish webhook to get a status on the operation.
Did this not work for you?
Hi @Ashish_Shah ,
Yes, we can use productSet with bulkOperationRunMutation and subscribe to the bulk_operations/finish webhook to take the status of the operation.
But the problem is that if the productSet call is made on the synchronous=false parameter (which is also the default), the webhook is triggered not at the completion of the productSet, but at its queuing.
The result we get is this:
{“data”:{“productSet”:{“product”:null,“productSetOperation”:{“id”:“gid://shopify/ProductSetOperation/19792026”,“status”:“CREATED”,“userErrors”:},“userErrors”:}},“__lineNumber”:0}
{“data”:{“productSet”:{“product”:null,“productSetOperation”:{“id”:“gid://shopify/ProductSetOperation/19890330”,“status”:“CREATED”,“userErrors”:},“userErrors”:}},“__lineNumber”:2}
{“data”:{“productSet”:{“product”:null,“productSetOperation”:{“id”:“gid://shopify/ProductSetOperation/19693722”,“status”:“CREATED”,“userErrors”:},“userErrors”:}},“__lineNumber”:1}
{“data”:{“productSet”:{“product”:null,“productSetOperation”:{“id”:“gid://shopify/ProductSetOperation/19824794”,“status”:“CREATED”,“userErrors”:},“userErrors”:}},“__lineNumber”:3}
The webhook is triggered but as you can see from the result it is triggered not when the product creation or update is completed, but when it is queued.
Then next we should make one or more calls for each product to see if it has finished so we can retrieve for example GIDs or to see that there were no errors.
The question remains. Is there a webhook that is triggered when the asychronous productSet operation is completed or do we need to create a pooling mechanism?
Hey @Marpe
You should not need a polling mechanism. The current state is probably an issue on our side with what you mentioned (synchronous=false parameter being used). We will fix this.
Hi @Ashish_Shah ,
Is there any updates to the fix? I am using the product set operation and are still seeing some products return productSetOperation:null:
{“data”:{“productSet”:{“product”:null,“productSetOperation”:{“status”:“CREATED”,“userErrors”:}}},“__lineNumber”:5276}
{“data”:{“productSet”:{“product”:null,“productSetOperation”:{“status”:“CREATED”,“userErrors”:}}},“__lineNumber”:5281}
{“data”:{“productSet”:{“product”:null,“productSetOperation”:null}},“__lineNumber”:5286}
Thank you!