App reviews, troubleshooting, and recommendations
Hi! I was using the documented example fileCreate code to upload files to the Shopify file page. However, graphQL is returning these errors:
Error: GraphQL error: FileCreateInput isn't a defined input type (on $files)
GraphQL error: Field 'fileCreate' doesn't exist on type 'Mutation'
GraphQL error: Variable $files is declared by fileCreate but not used
I can confirm my calls are in the most recent version (2021-07)
This is my ApolloClient code from the backend using the default CLI code. It should be using the 2021-07 version:
import ApolloClient from "apollo-boost";
export const createClient = (shop, accessToken) => {
return new ApolloClient({
uri: `https://${shop}/admin/api/2021-07/graphql.json`,
request: (operation) => {
operation.setContext({
headers: {
"X-Shopify-Access-Token": accessToken,
"User-Agent": `shopify-app-node ${process.env.npm_package_version} | Shopify App CLI`,
},
});
},
});
};
I'm completely confused why it isn't working. Any help would be greatly appreciated.
Hi @SaphiraDev
Hope you're having a great day!
I have a permissions problem instead, which proves that the mutation exists on the latest version. I did not have write_files access scope.
2021-07 (Latest)
2021-04 (Latest)
If you found this comment useful, hit the 'Like' and 'Accepted solution' buttons.
I'm getting the same error. Did you find the cause or a solution. I'm also using the 2021-07 API version.
Thank you!
Hi @SaphiraDev
What is the error message you get after trying what I suggested?
I found the reason. The shopify-api node module was an old one in my project.
So update the shopify-api to the latest version and change the API_VERSION to ApiVersion.July21 (or latest version) in server/server.js
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024