Development discussions around Shopify APIs
Hello,
I am having an issue with my app and am not sure where I am making a mistake.
When creating a staged upload I receive the following error:
Error:GraphQL error: Variable $input of type [StagedUploadInput!]! was provided invalid value for 0.resource (Expected "BULK_MUTATION_VARIABLES" to be one of: TIMELINE, PRODUCT_IMAGE, COLLECTION_IMAGE, SHOP_IMAGE, IMAGE, MODEL_3D, VIDEO)
My mutation looks as follows:
const STAGED_UPLOADS_CREATE = gql`
mutation stagedUploadsCreate($input: [StagedUploadInput!]!) {
stagedUploadsCreate(input: $input) {
stagedTargets {
resourceUrl
url
parameters {
name
value
}
}
userErrors {
field
message
}
}
}
`;
and I call the mutation as follows:
const [stagedUploadsCreate] = useMutation(STAGED_UPLOADS_CREATE);
const handleSubmit = async () => {
let { data } = await stagedUploadsCreate({
variables: {
input: [
{
resource: "BULK_MUTATION_VARIABLES",
filename: file.name,
mimeType: file.type,
httpMethod: "POST",
},
],
},
});
It looks like the staged upload is expecting an image or media, but I would like to upload a jsonl for a bulk mutation of product create.
If anyone had any pointers that would be greatly appreciated!
I used the Shopify CLI (Version 2.6.4)
Hi @joeydrake
I'm not able to see anything immediately wrong here. If you're still seeing that message, could you please post the full body of the actual request being sent to Shopify? The fields should match the example request found here: https://shopify.dev/api/usage/bulk-operations/imports#upload-the-file-to-shopify
Thanks!
CS | API Support @ Shopify
- Was my reply helpful? Click Like to let me 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
Bump! I am experiencing the exact same issue.
NodeJS SDK
shopify-api-node v3.8.0
Shopify API version
2021-04
@joeydrake I was able to solve the problem by upgrading to API version 2021-10. I had been using 2021-04 before the upgrade.
User | RANK |
---|---|
49 | |
11 | |
5 | |
5 | |
5 |
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023