Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Heroku应用程序错误。错误代码:503和H10。连接到数据库时出错_Node.js_Database_Heroku_Process_Environment Variables - Fatal编程技术网

Node.js Heroku应用程序错误。错误代码:503和H10。连接到数据库时出错

Node.js Heroku应用程序错误。错误代码:503和H10。连接到数据库时出错,node.js,database,heroku,process,environment-variables,Node.js,Database,Heroku,Process,Environment Variables,我正在运行react/redux前端和sequelize/express后端。一切都在我的本地系统上运行,这个应用程序在Heroku成功启动,直到几天前(或者至少在我注意到的时候)。现在,当我试图打开它时,我只会看到“应用程序错误”屏幕 从我将构建推送到Heroku直到崩溃,以下是Heroku日志: 2021-05-26T15:35:39.000000+00:00 app[api]: Build succeeded 2021-05-26T15:35:42.783549+00:00 heroku[

我正在运行react/redux前端和sequelize/express后端。一切都在我的本地系统上运行,这个应用程序在Heroku成功启动,直到几天前(或者至少在我注意到的时候)。现在,当我试图打开它时,我只会看到“应用程序错误”屏幕

从我将构建推送到Heroku直到崩溃,以下是Heroku日志:

2021-05-26T15:35:39.000000+00:00 app[api]: Build succeeded
2021-05-26T15:35:42.783549+00:00 heroku[web.1]: Starting process with command `npm start`
2021-05-26T15:35:47.633470+00:00 app[web.1]:
2021-05-26T15:35:47.633500+00:00 app[web.1]: > instagram-clone@1.0.0 start /app
2021-05-26T15:35:47.633501+00:00 app[web.1]: > per-env
2021-05-26T15:35:47.633501+00:00 app[web.1]:
2021-05-26T15:35:49.560858+00:00 app[web.1]:
2021-05-26T15:35:49.560886+00:00 app[web.1]: > instagram-clone@1.0.0 start:production /app
2021-05-26T15:35:49.560887+00:00 app[web.1]: > node ./bin/www
2021-05-26T15:35:49.560887+00:00 app[web.1]:
2021-05-26T15:35:51.608929+00:00 app[web.1]: Error connecting to database
2021-05-26T15:35:51.734352+00:00 heroku[web.1]: Process exited with status 0
2021-05-26T15:35:51.915636+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-26T15:35:51.919374+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-26T15:35:56.986578+00:00 heroku[web.1]: Starting process with command `npm start`
2021-05-26T15:36:02.109257+00:00 app[web.1]:
2021-05-26T15:36:02.109287+00:00 app[web.1]: > instagram-clone@1.0.0 start /app
2021-05-26T15:36:02.109288+00:00 app[web.1]: > per-env
2021-05-26T15:36:02.109288+00:00 app[web.1]:
2021-05-26T15:36:04.147834+00:00 app[web.1]:
2021-05-26T15:36:04.147883+00:00 app[web.1]: > instagram-clone@1.0.0 start:production /app
2021-05-26T15:36:04.147884+00:00 app[web.1]: > node ./bin/www
2021-05-26T15:36:04.147885+00:00 app[web.1]:
2021-05-26T15:36:08.145690+00:00 app[web.1]: Error connecting to database
2021-05-26T15:36:08.323027+00:00 heroku[web.1]: Process exited with status 0
2021-05-26T15:36:08.387353+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-26T15:36:09.412740+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=instagram51820.herokuapp.com request_id=84269189-4bb5-4c66-a474-69e7e2be0e5c fwd="73.80.9.120" dyno= connect= service= status=503 bytes= protocol=https
2021-05-26T15:36:09.529024+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=instagram51820.herokuapp.com request_id=5df8d7e0-c19d-4fa3-8380-67e0d63121e8 fwd="73.80.9.120" dyno= connect= service= status=503 bytes= protocol=https
在我的config index.js文件中,我将环境设置为:

environment: process.env.NODE_ENV || "development",
当我进行构建时,heroku确实认识到这就是现在的生产


我已经忙得不可开交了,似乎弄不清楚出了什么问题/发生了什么事。如果您有任何帮助,我们将不胜感激。

您是否在代码中硬编码了任何
端口
?不,我为前端设置了一个代理以命中(localhost:5000),但仅此而已。