我有一个 Next.js/Express/Apollo GraphQL 应用程序在本地主机上运行良好。
我尝试将其部署在 Zeit Now 上,Next.js 部分工作正常,但 GraphQL 后端失败,因为/graphql
路线返回:
502: An error occurred with your deployment
Code: NO_STATUS_CODE_FROM_LAMBDA
My now.json
好像:
{
"version": 2,
"builds": [
{ "src": "next.config.js", "use": "@now/next" },
{ "src": "server/server.js", "use": "@now/node" }
],
"routes": [
{ "src": "/api/(.*)", "dest": "server/server.js" },
{ "src": "/graphql", "dest": "server/server.js" }
]
}
建议?
以下是在 Zeit Now(作为无服务器函数/lambda)和 Heroku(使用 Express 服务器)上运行的 Next.js/Apollo GraphQL 的完整示例:
https://github.com/tomsoderlund/nextjs-pwa-graphql-sql-boilerplate https://github.com/tomsoderlund/nextjs-pwa-graphql-sql-boilerplate
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)