And I’m getting this error: “Variable $files of type [FileUpdateInput!]! was provided invalid value for 0.referencesToRemove (Field is not defined on FileUpdateInput), 0.referencesToAdd (Field is not defined on FileUpdateInput)”
Hey @MB-EQN - thanks for flagging this. I did a bit of testing on my end, and I think I might have a solution here! Could you try formatting the API call like this?
mutation fileUpdate($files: [FileUpdateInput!]!) {
fileUpdate(files: $files) {
files { id updatedAt }
userErrors { field message code }
}
}
I’d just make sure you’re adding the quotation marks for the input fields under the files object. I think this should resolve the issue, but let me know if the error persists and I can definitely take a closer look. Hope this helps.
No, that doesn’t fix the issue. Maybe I should’ve specified that but in my original post I used TypeScript syntax which doesn’t require quotation marks around object keys. The library that I’m using is shopify-api-node and it takes care of converting TypeScript objects into valid JSON strings before sending. Furthemore, the error that I’m getting references the fields by keys, confirming that JSON was parsed properly by Shopify servers.
Thanks for clarifying @MB-EQN - I’m unable to replicate the issue on my end here when I use my example above in an API client (Postman), the file is updated as expected and attached to the right product.
Would you be able to share an X-Request-ID from the API response headers we send out for an example call where you’re seeing the error message? I can take a look in our logs to see exactly what’s being passed over to us. Hope to hear from you soon!
While setting up logging for headers – I decided to try something else and it fixed the problem. shopify-api-node was the culprit: one of its configuration options is apiVersion which, according to its documentation, is optional and “defaults to the oldest supported stable version”. I’m not sure which specific version that is but it’s apparently not one of the versions that Shopify official documentation still lists. Explicitly setting it to 2025-07 fixed the issue I was getting.
Hey @MB-EQN - glad to hear the problem is resolved! I can’t say for sure why they’ve set the default to the older supported stable version since that looks to be a third party library. If you wanted to migrate to using our official library, that would be my recommendation, but I definitely get why using the Monei library works in some some cases:
Let me know if I can help with anything else on my end here