Does productCreateMedia mutation work asynchronously?

Does productCreateMedia mutation work asynchronously?

mglenc
Visitor
1 0 0

Hi,

We're preparing a Shopify integration that uploads media files (images) and associates them with Shopify products. We're using `stagedUploadsCreate` mutation to get upload link, then upload media file through a POST request and then we run `productCreateMedia` mutation to associate media file with a product. This procedure works just fine until we want to set metafields for the media we've just uploaded. Running `metafieldsSet` mutation just after getting a response from `productCreateMedia` (which includes media id) results in an error message saying `Owner does not exist.`. If I set a breakpoint in debugger before running `metafieldsSet` and wait at least one second, everything works fine. I haven't found any information about `productCreateMedia` mutation running asynchronously, but it seems that it does. How can we run `productCreateMedia` mutation synchronously?

 

Best regards

Replies 0 (0)