Ahmad Joya
Ahmad Joya

Reputation: 377

how to increase maximum operation depth in strapi graphql

here is the problem in graphql playground of strapi v4. says:

    "error": {
    "errors": [
      {
        "message": "'' exceeds maximum operation depth of 7",
        "locations": [
          {
            "line": 19,
            "column": 19
          }
        ],
        "extensions": {
          "code": "GRAPHQL_VALIDATION_FAILED",
          "exception": {
            "stacktrace": [
...

the maximum operation exceed in graphQL strapi

Upvotes: 4

Views: 3074

Answers (1)

Ahmad Joya
Ahmad Joya

Reputation: 377

Actually I found the problem and here is the solution. you just need to create a file inside of the config folder and then name it to plugins.js. and add these configuration inside of it. then samply increase the value of depthLimit to any depth level which you need.

module.exports = ({ env }) => ({
  graphql: {
    config: {
      endpoint: "/graphql",
      shadowCRUD: true,
      playgroundAlways: false,
      depthLimit: 7,
      amountLimit: 100,
      apolloServer: {
        tracing: false,
      },
    },
  },
});

Upvotes: 7

Related Questions