“收到状态码 400"在 apollo-server 部署到 heroku 之后 [英] "Received status code 400" after apollo-server deploy to heroku
问题描述
如果我在本地运行 npm start
- 一切正常
If I run localy npm start
- everything is ok
如果我运行 git subtree push --prefix server heroku-server master
- 构建成功!
If I run git subtree push --prefix server heroku-server master
- Build succeeded!
当我打开 https://tmdb-apollo.herokuapp.com/
- "error": "Response not success: Received status code 400"
如果我仍然进行查询或更改 - 它有效!魔法!(但我没有自动完成功能,右侧的 shema
侧边栏总是在旋转)
If I still do a query or mutation - it works! magic! (but I do not have autocomplete and shema
sidebar on the right is always spinning)
Github 存储库这里
我怀疑这与我的 MongoDB
连接设置有关
I suspect it has something to do with my MongoDB
connection setup
推荐答案
已经快 3 天了,我找到了解决方案:需要添加introspection: true
It's been nearly 3 days till I found a solution:
Need to add introspection: true
// Set up Apollo Server
const server = new ApolloServer({
typeDefs,
resolvers,
dataSources,
context,
introspection: true,
})
这篇关于“收到状态码 400"在 apollo-server 部署到 heroku 之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!