【发布时间】:2021-02-18 08:57:23
【问题描述】:
我尝试将我的 node.js 应用程序部署到 Heroku,在我尝试连接到它(打开应用程序)之前它工作正常。 错误是get如下:
2021-02-18T00:16:03.975921+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=gtdb.herokuapp.com request_id=16579da6-aa8e-4184-8e1c-7ac9680d0078 fwd="-myipaddresswhichidontwanttoshare-" dyno=web.1 connect=0ms service=1ms status=503 bytes=0 protocol=https
我的代码:
const express = require("express");
const https = require("https");
app = express();
const options = {
key: fs.readFileSync("./server.key"),
cert: fs.readFileSync("./server.crt")
};
const server = https.createServer(options, app);
server.listen(process.env.PORT);
当然,我搜索了这个问题,一些网站说它可能是超时,他们的错误有高达 30000 毫秒的连接和服务时间,超时会很有意义,但我离 30 秒还很远,所以我不知道是什么问题就在这里。 应用程序在抛出该错误后不会崩溃。 任何帮助深表感谢。提前致谢。
【问题讨论】:
标签: node.js express heroku hosting