首页 > 解决方案 > 如何在 magento graphql 上允许 GraphQL 自省

问题描述

跑步

   {
  __schema{
    types{
     name
      kind
    }
  }
}

{
  "errors": [
    {
      "message": "GraphQL introspection is not allowed, but the query contained __schema or __type",
      "category": "graphql",
      "locations": [
        {
          "line": 31,
          "column": 3
        }
      ]
    }
  ]
}

我在 Windows 上使用 GraphiQL 到 Magento graphql 服务器。如果我graphql get-schema使用 graphql-cli 在命令行上运行,我也会得到相同的结果。如何允许 Graphql 内省?

标签: graphqlmagento2

解决方案


您需要处于开发人员模式才能使用自省。

利用deploy:mode:set developer


推荐阅读