Image Mutation results in an error.

Highlighted
New Member
1 0 0

I am in the process of creating an app and was going through the documentation. When I make a mutation, i face this cryptic issue.


Error: GraphQL error: Internal error. Looks like something went wrong on our end.
Request ID: 0bb006b2-7794-4cc7-a8bf-825c4205cca4 (include this in support requests).

 

Mutation: 

 
mutation productImageUpdate($productId: ID!, $image: ImageInput!) {
    productImageUpdate(productId: $productId, image: $image) {
      image {
        id
      }
      userErrors {
        field
        message
      }
    }
  }
 
Code for the submit function - 
onAction: () => {
                              const image = {
                                src: imageSrc,
                              }
                              const productId = variantId;
                              handleSubmit({
                                variables: { productId: productId, image: image },
                               });
                            }
 
I do have write_product scope.
 
0 Likes
Highlighted
Shopify Staff
Shopify Staff
1040 140 165

Hey @teenvan1995 

Looks like you're providing a product variant ID instead of a product ID.

productId: "gid://shopify/ProductVariant/31863335944281"

Can you try again with a product ID? Let me know if it works and I'll see if we can improve the error message from this end.

0 Likes