Google Cloud Node.js (502 Bad Gateway) 日志中没有任何错误

Google Cloud Node.js (502 Bad Gateway) without any errors in logs

在我将 node.js 代码上传到应用引擎后,我从 google 云中获得了 (502 Bad Gateway nginx)。我的日志中没有错误。我在网上做了很多搜索,但没有任何帮助,但我看到一些文章说,由于响应时间长,服务器 returns (502 Bad Gateway).

这是我的收听代码:

const server = app.listen(8080, () => {
    const host = server.address().address;
    const port = server.address().port;

    console.log("EDU-vents server started");
});

这是我的 app.yaml:

runtime: nodejs
env: flex

我的 package.json 包含一个启动脚本

提前致谢。

通常,当您遇到 5.x.x(502、503 等)时,建议稍等片刻,然后重试请求。您可能会找到有关这些特定于 App Engine flexible environment.

的错误的更多信息

然而,大多数情况下,带有 "BAD_GATEWAY" 的错误代码 502 表示 GAE 终止了应用程序,因为它 运行 内存不足。默认情况下,GAE Flex 只有 1GB 内存,只有 600MB 可用于应用程序容器。以下documentation describes steps on how to troubleshoot this type of error (You will have to most likely investigate your Stackdriver logs.

我建议您为 VM 实例指定更高的 CPU 和 your instance. If specifying a higher CPU and Memory doesn't work. I recommend you to check the Nginx error logs . Before SSHing to the VM instance, you need to enable debug mode 的内存

如果不是这样,有没有支持package/free试用的?我建议您直接在他们的支持中心打开支持票,如果没有,您可以通过 Google Issue Tracker 联系 Google,因为 5XX 错误可能由不同的原因引起。