我不知道heroku的问题是什么,我花了两天的时间试图弄清楚这个错误意味着什么,但没有结果。
附录1:{“级别”:30,“时间”:1626582428741,"pid":44,"hostname":"98a3475f-ac16-4dfa-91e0-46d53d3b5e4c",“msg”:“服务器侦听http://127.0.0.1:34196"}”
服务器正在运行,你可以看到,但当我试图从网络访问我的应用程序。这种事会发生..。
2021-07-18T04:27:56.941807+00:00herokuweb.1: Error R10 (启动超时) ->进程在启动后60秒内无法绑定到$PORT
我不知道问题出在哪里。我的应用程序显然运行在预期的端口上,正如Heroku所指定的那样。
package.json
"scripts": {
"test": "npm run build:ts && tsc -p test/tsconfig.test.json && cross-env TS_NODE_FILES=true tap --ts test/**/*.test.ts",
"start": "npm run build:ts && fastify start -l info dist/app.js",
"build:ts": "tsc",
"dev": "tsc && concurrently -k -p \"[{name}]\" -n \"TypeScript,App\" -c \"yellow.bold,cyan.bold\" \"tsc -w\" \"fastify start --ignore-watch=.ts$ -w -l info -P dist/app.js\"",
"database": "npx prisma migrate dev && npx prisma db seed --preview-feature" },这是来自heroku logs --tail的日志
2021-07-19T04:34:45.411610+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-07-19T04:34:45.535520+00:00 heroku[web.1]: Process exited with status 137
2021-07-19T04:34:45.641077+00:00 heroku[web.1]: State changed from starting to crashed
2021-07-19T04:34:45.648836+00:00 heroku[web.1]: State changed from crashed to starting
2021-07-19T04:34:59.197914+00:00 heroku[web.1]: Starting process with command `npm start`
2021-07-19T04:35:02.499184+00:00 app[web.1]:
2021-07-19T04:35:02.499211+00:00 app[web.1]: > app@1.0.0 start /app
2021-07-19T04:35:02.499211+00:00 app[web.1]: > fastify start -l info dist/app.js
2021-07-19T04:35:02.499212+00:00 app[web.1]:
2021-07-19T04:35:03.830676+00:00 app[web.1]: {"level":40,"time":1626669303829,"pid":21,"hostname":"5b062824-4105-40ff-87b7-5846163fdac5","msg":"Allowing all origins"}
2021-07-19T04:35:03.856136+00:00 app[web.1]: {"level":40,"time":1626669303855,"pid":21,"hostname":"5b062824-4105-40ff-87b7-5846163fdac5","msg":"\"root\" path \"/app/assets\" must exist"}
2021-07-19T04:35:05.924577+00:00 app[web.1]: {"level":30,"time":1626669305924,"pid":21,"hostname":"5b062824-4105-40ff-87b7-5846163fdac5","msg":"Server listening at http://127.0.0.1:42948"}
2021-07-19T04:35:59.304046+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-07-19T04:35:59.382557+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-07-19T04:35:59.486461+00:00 heroku[web.1]: Process exited with status 137
2021-07-19T04:35:59.559137+00:00 heroku[web.1]: State changed from starting to crashed注意,应用程序运行得很好,但是过了一段时间,heroku就停止了工作,这是应用程序启动后的herokuweb.1,即appweb.1
发布于 2021-09-27 13:03:35
Heroku只能接受运行在0.0.0.0:{他们指定的端口}上的应用程序。我的Fasitfy应用程序运行在127.0.0.1上,显然与0.0.0.0不一样。然而,Heroku不接受0.0.0.0以外的任何端口。
发布于 2021-07-18 06:24:04
您可以调用tsc,构建它需要很长时间。
将build:ts更改为build,并在start脚本中删除npm run build:ts:
文档这里
{
"name": "something",
"others key": "here",
"scripts": {
"start":"fastify start -l info dist/app.js",
"build": "tsc",
"others script":"echo 'others'",
}
}https://stackoverflow.com/questions/68426111
复制相似问题