Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
I am using graphql admin API to backup our metafields definitions. But got this errors. Could someone help to look into the issue? Thanks.
Error Message:
{
networkStatusCode: 200,
message: "GraphQL Client: An error occurred while fetching from the API. Review 'graphQLErrors' for details.",
graphQLErrors: [
{
message: 'Internal error. Looks like something went wrong on our end.\n' +
'Request ID: 43326656-51ae-4ee4-a28f-ef4adf1a8368-1711492198 (include this in support requests).',
extensions: [Object]
}
]
}
Graphql query
`query {
metafieldDefinitions(first: 250, ownerType: ${type}) {
edges {
node {
name
namespace
key
description
type {
category
name
supportsDefinitionMigrations
supportedValidations {
name
type
}
}
ownerType
}
}
}
}`
Any update on this?
Hey @Natasha023 ,
Thanks for sharing that. It's tough to say exactly what may be happening here without looking in to the store specific details.
Looking at your query though, I can see you're requesting the first 250 definitions, which is at the top end of what's possible. The error could be due to the size of the request causing it to time out before it's returned.
What I would recommend here is to limit this to 50 and see if you get the same error. If not, then you can use pagination to get the remaining definitions.
- https://shopify.dev/docs/api/usage/pagination-graphql
If you get the same error with a smaller request, reach out to our support teams directly with that request ID so we can look in to it directly.
Hope that helps
- Kyle G.
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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
Hey Kyle,
Thanks for your response.
I followed your suggestion to limit the definitions to 50, but encountered the same error. (Even when I changed it to just one definition, it still didn't work.)
{
networkStatusCode: 200,
message: "GraphQL Client: An error occurred while fetching from the API. Review 'graphQLErrors' for details.",
graphQLErrors: [
{
message: 'Internal error. Looks like something went wrong on our end.\n' +
'Request ID: 72db11e1-f43e-4a98-a5a1-3057f1a7becc-1712618678 (include this in support requests).',
extensions: [Object]
}
]
}
{
networkStatusCode: 200,
message: "GraphQL Client: An error occurred while fetching from the API. Review 'graphQLErrors' for details.",
graphQLErrors: [
{
message: 'Internal error. Looks like something went wrong on our end.\n' +
'Request ID: 07a7ac79-f629-4643-8a6c-5776e8063a86-1712618679 (include this in support requests).',
extensions: [Object]
}
]
}
{
networkStatusCode: 200,
message: "GraphQL Client: An error occurred while fetching from the API. Review 'graphQLErrors' for details.",
graphQLErrors: [
{
message: 'Internal error. Looks like something went wrong on our end.\n' +
'Request ID: ac77945c-007b-40a7-a77d-9895f540b5c7-1712618679 (include this in support requests).',
extensions: [Object]
}
]
}
Here is the script to get metafields
mport {handleOperation} from "./index.js";
const ownerTypes = ["PRODUCT", "PRODUCTVARIANT", "COLLECTION"];
const returnOperation = (type) =>
`query {
metafieldDefinitions(first: 50, ownerType: ${type}) {
edges {
node {
name
namespace
key
description
type {
category
name
supportsDefinitionMigrations
supportedValidations {
name
type
}
}
ownerType
}
}
}
}`;
for (const type of ownerTypes) {
await handleOperation({operation: returnOperation(type), type});
}
We’ve got similar script for getting metaobject, which works for us.
import {handleOperation} from "./index.js";
const operation = `
query {
metaobjectDefinitions(first: 250) {
edges {
node {
id
name
type
description
fieldDefinitions {
key
name
description
type {
category
name
}
validations {
name
type
value
}
}
}
}
}
}`;
handleOperation({operation, type: "metaobject"});
Hey @Natasha023 ,
Thanks for sharing that you're still getting that error. Would you be able to reach out to our support teams with this information, along with the app ID and the store URL that you're working with. This way we can take a closer look with you.
- https://help.shopify.com/en/support/partners/org-select
Kind Regards,
Kyle G.
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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