What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Internal error with Private Metafields

Solved

Internal error with Private Metafields

Techbity
Visitor
2 0 0

Version:  2019-10

I got an error while trying to add privateMetafields to product's variants, here is what I got: 

 

Internal error. Looks like something went wrong on our end.\nRequest ID: 895cdbd0-0980-40e7-846f-df85d8c4776f (include this in support requests)."

 

Thank you!

Accepted Solution (1)

hassain
Shopify Staff (Retired)
624 104 189

This is an accepted solution.

Hey @Techbity 

 

From my search through our Shopify platform logs, it appears that this was your GraphQL Mutation:

mutation { productCreate(input: {title: "Redacted", options: ["color", "size"], images: [{src: "Redacted"}], variants: [{imageSrc: "Redacted", privateMetafields: {key: "external_usItemId", namespace: "external", valueInput: {value: "RedactedId", valueType: "STRING"}}, barcode: "", compareAtPrice: 15, price: 12, sku: "", options: ["pink", "1"]}]}) { product { id images(first: 1) { edges { cursor node { transformedSrc altText } } } } } }

The issue here is that within this mutation for productCreate, you were also attempting to create privateMetafields for a brand new Product Variant. If you would like to create privateMetafields for a Product Variant, it would need to be done in a separate mutation outside of productCreate. For example, you could first use the productCreate mutation to create the brand new Product and Product Variant, and then after use the productVariantUpdate mutation to create the privateMetafields onto the Product Variant. Alternatively you can use the productCreate variant to create the Product first, and then after use the productVariantCreate mutation to create the new Product Variant and its privateMetafields.

 

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 2 (2)

hassain
Shopify Staff (Retired)
624 104 189

This is an accepted solution.

Hey @Techbity 

 

From my search through our Shopify platform logs, it appears that this was your GraphQL Mutation:

mutation { productCreate(input: {title: "Redacted", options: ["color", "size"], images: [{src: "Redacted"}], variants: [{imageSrc: "Redacted", privateMetafields: {key: "external_usItemId", namespace: "external", valueInput: {value: "RedactedId", valueType: "STRING"}}, barcode: "", compareAtPrice: 15, price: 12, sku: "", options: ["pink", "1"]}]}) { product { id images(first: 1) { edges { cursor node { transformedSrc altText } } } } } }

The issue here is that within this mutation for productCreate, you were also attempting to create privateMetafields for a brand new Product Variant. If you would like to create privateMetafields for a Product Variant, it would need to be done in a separate mutation outside of productCreate. For example, you could first use the productCreate mutation to create the brand new Product and Product Variant, and then after use the productVariantUpdate mutation to create the privateMetafields onto the Product Variant. Alternatively you can use the productCreate variant to create the Product first, and then after use the productVariantCreate mutation to create the new Product Variant and its privateMetafields.

 

To learn more visit the Shopify Help Center or the Community Blog.

Techbity
Visitor
2 0 0

I got it. Thank you.


@hassain wrote:

Hey @Techbity 

 

From my search through our Shopify platform logs, it appears that this was your GraphQL Mutation:

mutation { productCreate(input: {title: "Redacted", options: ["color", "size"], images: [{src: "Redacted"}], variants: [{imageSrc: "Redacted", privateMetafields: {key: "external_usItemId", namespace: "external", valueInput: {value: "RedactedId", valueType: "STRING"}}, barcode: "", compareAtPrice: 15, price: 12, sku: "", options: ["pink", "1"]}]}) { product { id images(first: 1) { edges { cursor node { transformedSrc altText } } } } } }

The issue here is that within this mutation for productCreate, you were also attempting to create privateMetafields for a brand new Product Variant. If you would like to create privateMetafields for a Product Variant, it would need to be done in a separate mutation outside of productCreate. For example, you could first use the productCreate mutation to create the brand new Product and Product Variant, and then after use the productVariantUpdate mutation to create the privateMetafields onto the Product Variant. Alternatively you can use the productCreate variant to create the Product first, and then after use the productVariantCreate mutation to create the new Product Variant and its privateMetafields.