Hi, I’m re-posting a question that was unanswered on the old forums.
I’m looking to upload and attach Media to variants. The following scenario fails with this user error: “Non-ready media cannot be attached to variants”
Create Product (succeed)
Upload Media (succeed)
Attach Media to Product (succeed)
Attach Product Media to Variant (fails)
Has anyone ever figured out a way to deal with this? If I debug and go through the steps at human speed it works. How is anyone supposed to know when the media is ready without making another API call to check? this is going to take longer than it did the old REST way, which will no longer be an option soon…
I don’t know what the issue is. I am not using the productUpdate mutation,
I’m using productVariantAppendMedia. This is the call that returns “Non-ready media cannot be attached to variants”
When you’re uploading/attaching the media to the product, you need to check for the media status Media - GraphQL Admin
Because it could be processing videos etc as well as images, these could take a little time to process. Which is why I think you’ll be seeing it working at human speed.
I would check this status, until its ready.
Simplest way you could just put a small wait in. Or if you wanted a really robust way, you could poll until its ready.
Yes, I had to resort to doing a check of the status until it’s ready. Unfortunately this extra check will slow down the overall process, compared to using the REST API. It seemed strange to me that you could attach an image to a product without the media being ready, but not associate that image to a particular variant of that product…