What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Issues with ProductSet Mutation When Uploading Products with Minimal Attributes and Media Files

Issues with ProductSet Mutation When Uploading Products with Minimal Attributes and Media Files

yovasx2
Shopify Partner
5 0 1

Hi everyone,

I'm encountering an issue with the ProductSet mutation in Shopify's 2024-07 API when trying to create products that include associated media files uploaded via the fileCreate mutation. The problem only occurs when I try to create three or more similar products with minimal attributes.

Workflow:

  1. I upload media files using the fileCreate mutation.
  2. I poll the API until the images have a status of READY.
  3. I use the ProductSet mutation to create the products, including the media IDs.

Example Payload:

{
  "input": {
    "mediaIds": ["gid://shopify/MediaImage/26260547272792"],
    "title": "gio",
    "status": "DRAFT",
    "variants": [{
      "optionValues": [{ "optionName": "Title", "name": "Default Title" }],
      "price": 0
    }]
  }
}

Issue:

When submitting three or more similar products, some succeed while others fail with the error:

{
  "userErrors": [
    {
      "field": ["input"],
      "message": "Something went wrong, please try again."
    }
  ]
}

Additional Details:

  • The issue persists even after ensuring the media files are fully processed (READY status) before attaching them to the product.
  • When I retry the failed product creations, they succeed.
  • The error only happens when attempting to upload three or more similar products.

Has anyone experienced something similar or found a workaround for this?

Any help would be appreciated!


Context:

  • API Version: 2024-07
  • Product creation: ProductSet mutation
  • Media upload: fileCreate mutation
Reply 1 (1)

yovasx2
Shopify Partner
5 0 1

@Liam