Don’t have this problem with uploading video or images, but for some reason it’s not allowing me to upload 3d models with a .glb extension.
I successfully uploaded the file in the staging process, then when it comes to using ‘mutation fileCreate’ in the 2023-07 API, I get the following error:
“Provided filename extension must match original source.”
However, when I check the originalSource and the
filename in the
FileCreateInput, they have identical extensions:
filename: “Elephant_Plushie.glb”
originalSource: “https://storage.googleapis.com/threed-models-production/models/7f8f5ae52b281305/Elephant_Plushie.glb?external_model3d_id=bW9kZWwzZC03MDM0ODI=”
I’m wondering if the URL parameters in the originalSource url are not taken into consideration.
That’s bug #1.
I remove the filename field, then it appears to successfully upload with no errors.
But then it remains processing for several minutes before failing.
According to the documentation there should be nothing wrong with this FileCreateInput:
[{“contentType”:“FILE”,“originalSource”:“https://storage.googleapis.com/threed-models-production/models/1109b62369fd2700/Elephant_Plushie.glb?external_model3d_id=bW9kZWwzZC03MDM0OTg=”}]
However it’s just not working. I noticed the storage.googleapis URL when clicked is returning a 403 error code, but I assume the Shopify server when fetching the same URL does not have this issue.
Nothing is invalid with my 3D model, if I upload it using the Shopify Admin UI it uploads and is processed almost immediately.
Pretty sure these are a couple of bugs but there’s nowhere to report them.
Would appreciate hearing from anyone who has successfully managed to upload a 3D model via graphql.
EDIT:
I finally found a way around it. The problem (aka BUG) is in declaring the file ‘resource’ as ‘MODEL_3D’ like the documentation suggests.
This simply will not work, unless maybe the 3d model will be attached to a product.
So I set the resource to ‘FILE’ and the stagedUploadsCreate response gave me a URL that actually worked.
If in fact it was my mistake, and setting resource to ‘MODEL_3D’ will only work when using createProductMedia, then that is completely unintuitive and needs explaining in the documentation, and some helpful errors responses wouldn’t go amiss either.
Shopify’s API is a nightmare sometimes…
