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, 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 to build the frameworks of the node app. (Version 2.5.0)
User | RANK |
---|---|
8 | |
7 | |
4 | |
3 | |
3 |
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...
ByYour online store speed can enhance your store’s discoverability, boost conversion rates a...
ByShopping is at our fingertips with mobile devices. Is your theme optimized to be user-frie...
By