源 GraphQL API:HTTP 错误 400 错误请求
Source GraphQL API: HTTP error 400 Bad Request
我已经建立了一个可通过网关访问的 apollo 联盟架构。我想使用官方插件 gatsby-source-graphql 通过 gatsby 访问它。我遵循了他们的文档并尝试将插件包含在“简单”示例中。
当我在我的 gatsby 项目上 运行 yarn build
时,我得到以下终端输出:
success onPreInit - 0.048s
success initialize cache - 0.033s
success copy gatsby files - 0.139s
success Compiling Gatsby Functions - 0.239s
success onPreBootstrap - 0.258s
success createSchemaCustomization - 0.003s
ERROR #11321 PLUGIN
"gatsby-source-graphql" threw an error while running the sourceNodes lifecycle:
Source GraphQL API: HTTP error 400 Bad Request
Error: Source GraphQL API: HTTP error 400 Bad Request
- fetch.js:11 exports.fetchWrapper
[yotee.co]/[gatsby-source-graphql]/fetch.js:11:11
- task_queues:96 processTicksAndRejections
node:internal/process/task_queues:96:5
我的盖茨比-config.js是这样的:
module.exports = {
siteMetadata: {
url: "https://www.XXXX.co",
title: "XXXX",
description: "",
},
plugins: [
{
resolve: 'gatsby-source-graphql',
options: {
typeName: 'Gateway',
fieldName: 'gateway',
url: 'https://XXXXXX'
}
},
"gatsby-plugin-styled-components",
"gatsby-plugin-gatsby-cloud",
"@chakra-ui/gatsby-plugin",
"gatsby-plugin-react-helmet"
],
};
错误“源 GraphQL API:HTTP 错误 400 错误请求”非常模糊,我无法获得更详细的消息错误。
我该怎么做才能更好地理解并解决这个错误?
gatsby 插件将尝试从您的 apollo-server 检索模式。确保在生产中启用内省,这样这一步就不会失败。
{"extensions":{"code":"GRAPHQL_VALIDATION_FAILED"},"level":"warn","locations":[{"column":3,"line":2}],"message":"GraphQL introspection is not allowed by Apollo Server, but the query contained __schema or __type. To enable introspection, pass introspection: true to ApolloServer in production"}
作者:
const server = new ApolloServer({
// other properties
introspection: true
});
我已经建立了一个可通过网关访问的 apollo 联盟架构。我想使用官方插件 gatsby-source-graphql 通过 gatsby 访问它。我遵循了他们的文档并尝试将插件包含在“简单”示例中。
当我在我的 gatsby 项目上 运行 yarn build
时,我得到以下终端输出:
success onPreInit - 0.048s
success initialize cache - 0.033s
success copy gatsby files - 0.139s
success Compiling Gatsby Functions - 0.239s
success onPreBootstrap - 0.258s
success createSchemaCustomization - 0.003s
ERROR #11321 PLUGIN
"gatsby-source-graphql" threw an error while running the sourceNodes lifecycle:
Source GraphQL API: HTTP error 400 Bad Request
Error: Source GraphQL API: HTTP error 400 Bad Request
- fetch.js:11 exports.fetchWrapper
[yotee.co]/[gatsby-source-graphql]/fetch.js:11:11
- task_queues:96 processTicksAndRejections
node:internal/process/task_queues:96:5
我的盖茨比-config.js是这样的:
module.exports = {
siteMetadata: {
url: "https://www.XXXX.co",
title: "XXXX",
description: "",
},
plugins: [
{
resolve: 'gatsby-source-graphql',
options: {
typeName: 'Gateway',
fieldName: 'gateway',
url: 'https://XXXXXX'
}
},
"gatsby-plugin-styled-components",
"gatsby-plugin-gatsby-cloud",
"@chakra-ui/gatsby-plugin",
"gatsby-plugin-react-helmet"
],
};
错误“源 GraphQL API:HTTP 错误 400 错误请求”非常模糊,我无法获得更详细的消息错误。
我该怎么做才能更好地理解并解决这个错误?
gatsby 插件将尝试从您的 apollo-server 检索模式。确保在生产中启用内省,这样这一步就不会失败。
{"extensions":{"code":"GRAPHQL_VALIDATION_FAILED"},"level":"warn","locations":[{"column":3,"line":2}],"message":"GraphQL introspection is not allowed by Apollo Server, but the query contained __schema or __type. To enable introspection, pass introspection: true to ApolloServer in production"}
作者:
const server = new ApolloServer({
// other properties
introspection: true
});