使用 heroku 部署 PERN 应用程序,部署后应用程序崩溃

时间:2021-02-06 15:51:22

标签: node.js reactjs postgresql express heroku

这是我第一次开发全栈 pern 应用程序,也是第一次使用 heroku 进行部署。 我设法使用以下命令将我的应用程序上传到 heroku:sudo git push heroku master。 但是当我打开应用程序链接时,控制台中出现如下错误: 1- /api/products:1 加载资源失败:服务器响应状态为 503(服务不可用) 2- asyncToGenerator.js:6 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position。 当我重新访问网站时,它崩溃并说(应用程序错误 应用程序发生错误,无法提供您的页面。如果您是应用程序所有者,请检查您的日志以了解详细信息。您可以使用以下命令从 Heroku CLI 执行此操作) 我做了:heroku logs --tail 这就是结果(很长):

======================

2021-02-06T15:39:54.635194+00:00 app[web.1]: 
2021-02-06T15:39:54.635195+00:00 app[web.1]: TypeError: Cannot read property 'rows' of undefined
2021-02-06T15:39:54.635195+00:00 app[web.1]: at /app/server.js:139:21
2021-02-06T15:39:54.635196+00:00 app[web.1]: at PendingItem.callback (/app/node_modules/pg-pool/index.js:352:16)
2021-02-06T15:39:54.635197+00:00 app[web.1]: at Client._connectionCallback (/app/node_modules/pg-pool/index.js:244:23)
2021-02-06T15:39:54.635197+00:00 app[web.1]: at Client._handleErrorWhileConnecting (/app/node_modules/pg/lib/client.js:305:19)
2021-02-06T15:39:54.635197+00:00 app[web.1]: at Client._handleErrorMessage (/app/node_modules/pg/lib/client.js:325:19)
2021-02-06T15:39:54.635198+00:00 app[web.1]: at Connection.emit (node:events:379:20)
2021-02-06T15:39:54.635199+00:00 app[web.1]: at /app/node_modules/pg/lib/connection.js:115:12
2021-02-06T15:39:54.635199+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:40:17)
2021-02-06T15:39:54.635199+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2021-02-06T15:39:54.635200+00:00 app[web.1]: at Socket.emit (node:events:379:20)
2021-02-06T15:39:54.657366+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/api/products" host=omar-market.herokuapp.com request_id=8dc92f1a-5127-474d-9ec5-da29c69e6476 fwd="197.63.77.140" dyno=web.1 connect=0ms service=63ms status=503 bytes=0 protocol=https
2021-02-06T15:39:54.680558+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-02-06T15:39:54.681493+00:00 app[web.1]: npm ERR! errno 1
2021-02-06T15:39:54.699852+00:00 app[web.1]: npm ERR! server@1.0.0 start: `node server.js`
2021-02-06T15:39:54.700575+00:00 app[web.1]: npm ERR! Exit status 1
2021-02-06T15:39:54.701174+00:00 app[web.1]: npm ERR!
2021-02-06T15:39:54.701598+00:00 app[web.1]: npm ERR! Failed at the server@1.0.0 start script.
2021-02-06T15:39:54.701993+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-02-06T15:39:54.743092+00:00 app[web.1]: 
2021-02-06T15:39:54.744975+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-02-06T15:39:54.745405+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2021-02-06T15_39_54_703Z-debug.log
2021-02-06T15:39:54.837009+00:00 heroku[web.1]: Process exited with status 1
2021-02-06T15:39:54.906299+00:00 heroku[web.1]: State changed from up to crashed
2021-02-06T15:39:54.918338+00:00 heroku[web.1]: State changed from crashed to starting
2021-02-06T15:40:10.892128+00:00 heroku[web.1]: Starting process with command `npm start`
2021-02-06T15:40:14.640132+00:00 app[web.1]: 
2021-02-06T15:40:14.640192+00:00 app[web.1]: > server@1.0.0 start /app
2021-02-06T15:40:14.640193+00:00 app[web.1]: > node server.js
2021-02-06T15:40:14.640193+00:00 app[web.1]: 
2021-02-06T15:40:15.226215+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2021-02-06T15:40:15.226246+00:00 app[web.1]: designed for a production environment, as it will leak
2021-02-06T15:40:15.226247+00:00 app[web.1]: memory, and will not scale past a single process.
2021-02-06T15:40:15.650375+00:00 heroku[web.1]: State changed from starting to up
2021-02-06T15:40:16.820946+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=omar-market.herokuapp.com request_id=4d5fc991-1776-44fc-b7c2-cc8b38f8fd37 fwd="197.63.77.140" dyno=web.1 connect=1ms service=37ms status=200 bytes=4219 protocol=https
2021-02-06T15:40:17.456641+00:00 heroku[router]: at=info method=GET path="/manifest.json" host=omar-market.herokuapp.com request_id=61001cc5-1794-4e98-9ad3-277c15515a22 fwd="197.63.77.140" dyno=web.1 connect=0ms service=24ms status=200 bytes=859 protocol=https
2021-02-06T15:40:17.500390+00:00 heroku[router]: at=info method=GET path="/static/js/2.346ca167.chunk.js.map" host=omar-market.herokuapp.com request_id=9d275dfb-39cd-4d5c-8355-5902e902202e fwd="197.63.77.140" dyno=web.1 connect=1ms service=28ms status=200 bytes=516534 protocol=https
2021-02-06T15:40:17.629699+00:00 heroku[router]: at=info method=GET path="/manifest.json" host=omar-market.herokuapp.com request_id=a8244819-b16d-4647-8df6-6e3335e2a50a fwd="197.63.77.140" dyno=web.1 connect=0ms service=7ms status=304 bytes=309 protocol=https
2021-02-06T15:40:17.664223+00:00 heroku[router]: at=info method=GET path="/logo192.png" host=omar-market.herokuapp.com request_id=d172d6d9-4df2-4146-9236-7e01b96996cd fwd="197.63.77.140" dyno=web.1 connect=1ms service=5ms status=200 bytes=5694 protocol=https
2021-02-06T15:40:17.898960+00:00 heroku[router]: at=info method=GET path="/static/css/main.19af8669.chunk.css" host=omar-market.herokuapp.com request_id=03448a06-0fd4-4933-aa5f-b594960fa492 fwd="197.63.77.140" dyno=web.1 connect=1ms service=3ms status=304 bytes=310 protocol=https
2021-02-06T15:40:17.940624+00:00 heroku[router]: at=info method=GET path="/static/js/main.1841cc5f.chunk.js.map" host=omar-market.herokuapp.com request_id=6d47ca61-7c42-4fd8-a895-ab1a5cfc5026 fwd="197.63.77.140" dyno=web.1 connect=0ms service=9ms status=200 bytes=36481 protocol=https
2021-02-06T15:40:18.416561+00:00 heroku[router]: at=info method=GET path="/static/css/main.19af8669.chunk.css.map" host=omar-market.herokuapp.com request_id=277e507d-97cf-4f54-a3c1-7138d716fcda fwd="197.63.77.140" dyno=web.1 connect=0ms service=13ms status=200 bytes=42303 protocol=https
2021-02-06T15:40:27.224657+00:00 app[web.1]: error: no pg_hba.conf entry for host "18.207.216.174", user "ghrbdxrldvjqsj", database "d5e89bgkicfpba", SSL off
2021-02-06T15:40:27.224668+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
2021-02-06T15:40:27.224668+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2021-02-06T15:40:27.224671+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2021-02-06T15:40:27.224671+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2021-02-06T15:40:27.224672+00:00 app[web.1]: at Socket.emit (node:events:379:20)
2021-02-06T15:40:27.224673+00:00 app[web.1]: at addChunk (node:internal/streams/readable:313:12)
2021-02-06T15:40:27.224673+00:00 app[web.1]: at readableAddChunk (node:internal/streams/readable:288:9)
2021-02-06T15:40:27.224674+00:00 app[web.1]: at Socket.Readable.push (node:internal/streams/readable:227:10)
2021-02-06T15:40:27.224674+00:00 app[web.1]: at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
2021-02-06T15:40:27.224675+00:00 app[web.1]: length: 168,
2021-02-06T15:40:27.224676+00:00 app[web.1]: severity: 'FATAL',
2021-02-06T15:40:27.224677+00:00 app[web.1]: code: '28000',
2021-02-06T15:40:27.224677+00:00 app[web.1]: detail: undefined,
2021-02-06T15:40:27.224677+00:00 app[web.1]: hint: undefined,
2021-02-06T15:40:27.224678+00:00 app[web.1]: position: undefined,
2021-02-06T15:40:27.224678+00:00 app[web.1]: internalPosition: undefined,
2021-02-06T15:40:27.224679+00:00 app[web.1]: internalQuery: undefined,
2021-02-06T15:40:27.224679+00:00 app[web.1]: where: undefined,
2021-02-06T15:40:27.224680+00:00 app[web.1]: schema: undefined,
2021-02-06T15:40:27.224680+00:00 app[web.1]: table: undefined,
2021-02-06T15:40:27.224681+00:00 app[web.1]: column: undefined,
2021-02-06T15:40:27.224681+00:00 app[web.1]: dataType: undefined,
2021-02-06T15:40:27.224681+00:00 app[web.1]: constraint: undefined,
2021-02-06T15:40:27.224682+00:00 app[web.1]: file: 'auth.c',
2021-02-06T15:40:27.224682+00:00 app[web.1]: line: '515',
2021-02-06T15:40:27.224682+00:00 app[web.1]: routine: 'ClientAuthentication'
2021-02-06T15:40:27.224683+00:00 app[web.1]: }
2021-02-06T15:40:27.228578+00:00 app[web.1]: /app/server.js:139
2021-02-06T15:40:27.228580+00:00 app[web.1]: res.json(result.rows);
2021-02-06T15:40:27.228581+00:00 app[web.1]: ^
2021-02-06T15:40:27.228582+00:00 app[web.1]: 
2021-02-06T15:40:27.228583+00:00 app[web.1]: TypeError: Cannot read property 'rows' of undefined
2021-02-06T15:40:27.228583+00:00 app[web.1]: at /app/server.js:139:21
2021-02-06T15:40:27.228584+00:00 app[web.1]: at PendingItem.callback (/app/node_modules/pg-pool/index.js:352:16)
2021-02-06T15:40:27.228585+00:00 app[web.1]: at Client._connectionCallback (/app/node_modules/pg-pool/index.js:244:23)
2021-02-06T15:40:27.228586+00:00 app[web.1]: at Client._handleErrorWhileConnecting (/app/node_modules/pg/lib/client.js:305:19)
2021-02-06T15:40:27.228586+00:00 app[web.1]: at Client._handleErrorMessage (/app/node_modules/pg/lib/client.js:325:19)
2021-02-06T15:40:27.228587+00:00 app[web.1]: at Connection.emit (node:events:379:20)
2021-02-06T15:40:27.228587+00:00 app[web.1]: at /app/node_modules/pg/lib/connection.js:115:12
2021-02-06T15:40:27.228588+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:40:17)
2021-02-06T15:40:27.228588+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2021-02-06T15:40:27.228589+00:00 app[web.1]: at Socket.emit (node:events:379:20)
2021-02-06T15:40:27.263599+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/api/products" host=omar-market.herokuapp.com request_id=9ab97bee-9e6f-42ba-be99-9e94d805f771 fwd="197.63.77.140" dyno=web.1 connect=1ms service=113ms status=503 bytes=0 protocol=https
2021-02-06T15:40:27.272105+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-02-06T15:40:27.272736+00:00 app[web.1]: npm ERR! errno 1
2021-02-06T15:40:27.281763+00:00 app[web.1]: npm ERR! server@1.0.0 start: `node server.js`
2021-02-06T15:40:27.282024+00:00 app[web.1]: npm ERR! Exit status 1
2021-02-06T15:40:27.282304+00:00 app[web.1]: npm ERR!
2021-02-06T15:40:27.282529+00:00 app[web.1]: npm ERR! Failed at the server@1.0.0 start script.
2021-02-06T15:40:27.282798+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-02-06T15:40:27.323337+00:00 app[web.1]: 
2021-02-06T15:40:27.323657+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-02-06T15:40:27.323858+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2021-02-06T15_40_27_283Z-debug.log
2021-02-06T15:40:27.414576+00:00 heroku[web.1]: Process exited with status 1
2021-02-06T15:40:27.515335+00:00 heroku[web.1]: State changed from up to crashed
2021-02-06T15:40:54.964464+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/api/signup" host=omar-market.herokuapp.com request_id=4d8128a8-3c96-4829-a312-d16def2c5ebc fwd="197.63.77.140" dyno= connect= service= status=503 bytes= protocol=https

====================== 我不知道如何解决这个问题。请问有什么解决办法吗?

0 个答案:

没有答案