A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I want to upload a 3D model to a product page using GraphQL api. I followed the steps in this tutorial and managed to install graphiql editor in the development store as well. However, after I uploaded the 3D model to a specified product page and viewing the corresponding product in the browser, Shopify claims that the model was failed to validate. But I don't get any error in the graphql media create API response.
First,I do a staged upload:
mutation stagedUploadsCreate($input: [StagedUploadInput!]!) {
stagedUploadsCreate(input: $input) {
stagedTargets {
resourceUrl
url
}
userErrors {
field
message
}
}
}
variables:
{
"input": [
{
"resource": "MODEL_3D",
"filename": "https://raw.githubusercontent.com/pavinduLakshan/model/master/original_glb.glb",
"mimeType": "model/gltf-binary",
"fileSize": "197172"
}
]
}
Then I do a product create media as follows using the resourceUri obtained in the above request.
mutation productCreateMedia($productId: ID!, $media: [CreateMediaInput!]!) {
productCreateMedia(productId: $productId, media: $media) {
media {
alt
}
mediaUserErrors {
code
field
message
}
product {
id
}
}
}
variables:
{
"productId": "gid://shopify/Product/5499834007719",
"media": [
{
"originalSource": "https://storage.googleapis.com/threed-models-production/models/9dfef9c163e2fcc8/https_raw_githubusercontent_com_pavinduLakshan_model_master_original_glb.glb?external_model3d_id=bW9kZWwzZC00MDM5Mw==",
"mediaContentType": "MODEL_3D"
}
]
}
I don't get any error when uploading the 3D model:
but in the corresponding product update page in the Shopify admin UI, I'm getting an error message like below.
Can someone please help me to understand why this error is happening? Thank you very much for the all helpful suggestions.
Hi, Were you able you resolve this issue? I am getting the same error when trying to upload video.
Some of your media failed to upload, please retry again.
demo-video.mp4: Video failed validation
Hi, anyway you figured out the issue with this ?
Hey Folks @Xen-dev @Tina86 @pavindu
If you are still experiencing this error, please do reach out to our Support Team via our Shopify Help Center with some additional context and examples and we can absolutely help look into the cause of these errors in each individual case further.
When reaching out to support if you can please provide the following:
This context requested above will allow our support team to authenticate with your store and take a closer look into each individual case to help determine the cause of the errors.
I hope this helps, and I hope you all have a great day 🙂
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog