What is the query depth limit in GraphQL?

Solved

What is the query depth limit in GraphQL?

luckychauhan
Shopify Partner
1 0 1

Hi Team,

Thank you for your response.
To Clarify you more please consider the below points:
Query depth:The depth is the number of nesting levels of the field.
For example
The following is a query with a depth of 3.

{
    a {
        b {
            c
        }
    }
}
Like wise, we want to know for Shopify is there any query depth?
The query which we have inquired is of more technical, can you please involve your Dev team and confirm on the details.

Thanks

Accepted Solutions (2)

miacx
Shopify Partner
3 2 0

This is an accepted solution.

In my recent encounter with the query depth limit, it's 17. Though I am not entirely sure whether it's the limit of the Storefront API, or the GraphQL client in the @Shopify/storefront-api-client package...

{
  errors: {
    networkStatusCode: 200,
    message: "GraphQL Client: An error occurred while fetching from the API. Review 'graphQLErrors' for details.",
    graphQLErrors: [ [Object] ],
    response: Response {
      [Symbol(realm)]: null,
      [Symbol(state)]: [Object],
      [Symbol(headers)]: [HeadersList]
    }
  }
}
Query has a depth of 19, which exceeds the max depth of 17.

 

View solution in original post

miacx
Shopify Partner
3 2 0

This is an accepted solution.

This query might be a little over the top, but it's genuinely necessary data, just gotta identify the problem area & split up the query now...

View solution in original post

Replies 4 (4)

miacx
Shopify Partner
3 2 0

This is an accepted solution.

In my recent encounter with the query depth limit, it's 17. Though I am not entirely sure whether it's the limit of the Storefront API, or the GraphQL client in the @Shopify/storefront-api-client package...

{
  errors: {
    networkStatusCode: 200,
    message: "GraphQL Client: An error occurred while fetching from the API. Review 'graphQLErrors' for details.",
    graphQLErrors: [ [Object] ],
    response: Response {
      [Symbol(realm)]: null,
      [Symbol(state)]: [Object],
      [Symbol(headers)]: [HeadersList]
    }
  }
}
Query has a depth of 19, which exceeds the max depth of 17.

 

miacx
Shopify Partner
3 2 0

This is an accepted solution.

This query might be a little over the top, but it's genuinely necessary data, just gotta identify the problem area & split up the query now...

aHaris92
Visitor
1 0 0

what is actually accepted solution?

miacx
Shopify Partner
3 2 0

The OP marked my reply (addendum) to my first reply as an accepted solution as well. This can be confusing but might also provide important context. The top reply of mine is the accepted solution, the max-depth is 17.