这个问题通常是由于 Apollo Server 的配置问题导致的。需要检查执行以下步骤以确保已正确设置。
ApolloServer
配置introspection
和 playground
属性都被设置为 true
示例代码:
const apolloServer = new ApolloServer({
schema,
introspection: true,
playground: true,
context: ({ req }) => ({ req })
});
在您的配置文件中将 introspection
和 playground
属性设置为 true
会确保在启动您的服务器时开启它们。如果您的 Apollo Server 已正常配置但仍遇到此错误,请检查你是否有任何未知的错误,最好查看您的服务器日志以寻找有关此问题的更多信息。