Hello
I am facing an issue in returning in file Graph QL API
I need file image url in resposne.
Here is my query that I am using it is uploading the file to shopify successfully but not returning the image url in response. Anyone can you please reply
Query
========
mutation fileCreate($files: [FileCreateInput!]!) {
fileCreate(files: $files) {
files {
alt
createdAt
fileStatus
... on MediaImage {
id
image {
id
url
altText
height
width
}
}
}
userErrors {
field
message
}
}
}
Variables
==========
{
"files": {
"alt": "sama",
"contentType": "FILE",
"originalSource": "https://cdn.shopify.com/s/files/1/0468/4100/4189/files/WhatsApp_Image_2021-02-05_at_12.46.49_PM_320x.jpg?v=1614291695"
}
}
Topic summary
A developer is experiencing an issue with Shopify’s fileCreate GraphQL API mutation. While files upload successfully to Shopify, the API response does not include the image URL as expected.
Current Problem:
- The fileCreate mutation completes without errors
- Image URL is missing from the response despite requesting it in the query
- The query includes fields for MediaImage including URL, dimensions, and metadata
Workaround Solution:
Another user reports the same issue and shares a multi-step workaround:
- Obtain the resource URL from stagedUploadsCreate
- Upload the file
- Wait a few seconds
- Search for the uploaded file
- Update the database with the Shopify resource URL
This suggests the image URL may not be immediately available after upload and requires a delayed follow-up request to retrieve it. The issue appears to be a timing/synchronization problem with Shopify’s file processing system.
same issue, I had to put a timer to request the file again, right now the solution is this.
-
get resource url
-
upload to file
-
save the resource url from stageFileCreate
-
wait few seconds
-
search for the file you uploaded
-
update the db with the shopify resource url