应用程序部署到 heroku 但返回服务器错误

时间:2021-03-06 04:09:31

标签: node.js heroku

当我在本地运行时,我的应用程序运行良好。但是,一旦部署到 Heroku,服务器就停止返回数据并返回 500 代码。我的所有代码都可以在 here 中找到,并且实时应用程序(无法运行)是 here

编辑: 这是heroku日志:

from pathlib import Path
import csv
csv_file = Path(Path.cwd(), ms_access_table_name + '.csv')
my_df.to_csv(csv_file, sep = ',', quoting=csv.QUOTE_NONNUMERIC , index=False)
ms_sql = f'INSERT INTO {ms_access_table_name} ({ms_access_columns}) \n' +\
            f'SELECT {ms_access_columns} \n' + \
            f'FROM [text;HDR=Yes;FMT=Delimited(,);IMEX=2;Database={Path.cwd()}].{ms_access_table_name + ".csv"}'
cursor.execute(ms_sql)
cursor.commit()

cursor.close()
conn.close()

编辑 2: 事实证明,我已将 2021-03-06T04:00:59.416851+00:00 heroku[router]: at=info method=GET path="/" host=fast-shore-66611.herokuapp.com request_id=0a279e6e-c6d0-4bf8-ac4d-45d85c914e4a fwd="174.45.175.167" dyno=web.1 connect=1ms service=50ms status=200 bytes=1401 protocol=https 2021-03-06T04:00:59.672729+00:00 heroku[router]: at=info method=GET path="/js/app.71b734f2.js" host=fast-shore-66611.herokuapp.com request_id=68509950-00e2-4f0d-84ea-3a96cf0dcbc1 fwd="174.45.175.167" dyno=web.1 connect=1ms service=21ms status=200 bytes=62457 protocol=https2021-03-06T04:01:00.023258+00:00 heroku[router]: at=info method=GET path="/css/app.badeae52.css" host=fast-shore-66611.herokuapp.com request_id=603ee68a-bc30-4c7e-8177-3e3c0f3fa712 fwd="174.45.175.167" dyno=web.1 connect=0ms service=22ms status=200 bytes=3523 protocol=https 2021-03-06T04:01:00.035863+00:00 heroku[router]: at=info method=GET path="/js/chunk-vendors.e9c4f783.js" host=fast-shore-66611.herokuapp.com request_id=8e857b3a-b40d-4ad8-a1aa-cb8dc6d3b15a fwd="174.45.175.167" dyno=web.1 connect=0ms service=39ms status=200 bytes=501256 protocol=https 2021-03-06T04:01:04.003747+00:00 heroku[router]: at=info method=GET path="/result/tyler" host=fast-shore-66611.herokuapp.com request_id=45020e4f-61d5-419d-9a51-f61ccb06b257 fwd="174.45.175.167" dyno=web.1 connect=0ms service=21ms status=500 bytes=284 protocol=https 2021-03-06T04:01:08.110920+00:00 heroku[router]: at=info method=GET path="/result/henderson" host=fast-shore-66611.herokuapp.com request_id=e9f739c3-36cb-4d3e-a480-e93d0784ea66 fwd="174.45.175.167" dyno=web.1 connect=0ms service=17ms status=500 bytes=284 protocol=https 2021-03-06T04:01:33.000000+00:00 app[api]: Build started by user reaganclayton1995@gmail.com 2021-03-06T04:01:38.112111+00:00 heroku[router]: at=info method=GET path="/result/tyler" host=fast-shore-66611.herokuapp.com request_id=f8a0dd9a-a033-430a-8249-6f433b6066a5 fwd="174.45.175.167" dyno=web.1 connect=0ms service=45ms status=500 bytes=284 protocol=https 2021-03-06T04:01:40.977816+00:00 heroku[router]: at=info method=GET path="/result/tyler" host=fast-shore-66611.herokuapp.com request_id=305a750b-8ca6-486c-9cee-a7b9b3e64891 fwd="174.45.175.167" dyno=web.1 connect=0ms service=9ms status=500 bytes=284 protocol=https 2021-03-06T04:01:46.859981+00:00 heroku[router]: at=info method=GET path="/" host=fast-shore-66611.herokuapp.com request_id=738c1e2e-ed83-4fef-86e3-52813667b798 fwd="174.45.175.167" dyno=web.1 connect=0ms service=3ms status=304 bytes=269 protocol=https 2021-03-06T04:01:47.095156+00:00 heroku[router]: at=info method=GET path="/js/app.71b734f2.js" host=fast-shore-66611.herokuapp.com request_id=aa992042-2411-439d-b982-e180501f2e07 fwd="174.45.175.167" dyno=web.1 connect=1ms service=8ms status=304 bytes=270 protocol=https 2021-03-06T04:01:47.101684+00:00 heroku[router]: at=info method=GET path="/css/app.badeae52.css" host=fast-shore-66611.herokuapp.com request_id=aad26a97-869d-450b-9d14-b1deac43a470 fwd="174.45.175.167" dyno=web.1 connect=0ms service=30ms status=200 bytes=3523 protocol=https 2021-03-06T04:01:47.157018+00:00 heroku[router]: at=info method=GET path="/js/chunk-vendors.e9c4f783.js" host=fast-shore-66611.herokuapp.com request_id=4eb14331-e0c3-4127-b691-0f036cca30a4 fwd="174.45.175.167" dyno=web.1 connect=0ms service=59ms status=304 bytes=271 protocol=https 2021-03-06T04:02:07.327105+00:00 app[api]: Deploy 36a0a5b6 by user reaganclayton1995@gmail.com 2021-03-06T04:02:07.327105+00:00 app[api]: Release v10 created by user reaganclayton1995@gmail.com 2021-03-06T04:02:07.516033+00:00 heroku[web.1]: Restarting 2021-03-06T04:02:07.541614+00:00 heroku[web.1]: State changed from up to starting 2021-03-06T04:02:08.000000+00:00 app[api]: Build succeeded 2021-03-06T04:02:09.003004+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2021-03-06T04:02:09.247345+00:00 heroku[web.1]: Process exited with status 143 2021-03-06T04:02:09.633378+00:00 heroku[web.1]: Starting process with command `npm start` 2021-03-06T04:02:12.908565+00:00 app[web.1]: 2021-03-06T04:02:12.908594+00:00 app[web.1]: > weatherup@1.0.0 start 2021-03-06T04:02:12.908594+00:00 app[web.1]: > node server 2021-03-06T04:02:12.908595+00:00 app[web.1]: 2021-03-06T04:02:13.113839+00:00 app[web.1]: Server running in production mode on port 39626 2021-03-06T04:02:13.917299+00:00 heroku[web.1]: State changed from starting to up 2021-03-06T04:09:34.447563+00:00 heroku[router]: at=info method=GET path="/" host=fast-shore-66611.herokuapp.com request_id=b591ded0-7f1a-4c14-a1e2-7f856a2e45aa fwd="54.164.83.156" dyno=web.1 connect=1ms service=24ms status=200 bytes=1401 protocol=https 2021-03-06T04:10:06.594714+00:00 heroku[router]: at=info method=HEAD path="/" host=fast-shore-66611.herokuapp.com request_id=b063d8b0-d361-40a2-a0e8-85b2ac937292 fwd="217.182.175.162" dyno=web.1 connect=0ms service=2ms status=200 bytes=321 protocol=https 2021-03-06T04:11:00.259797+00:00 heroku[router]: at=info method=GET path="/result/tyler" host=fast-shore-66611.herokuapp.com request_id=216b9449-8ad7-4bf4-8780-99d3db9ea0c0 fwd="174.45.175.167" dyno=web.1 connect=1ms service=7ms status=500 bytes=284 protocol=https 2021-03-06T04:11:03.661150+00:00 heroku[router]: at=info method=GET path="/result/henderson" host=fast-shore-66611.herokuapp.com request_id=9b656dd6-dccc-4271-a507-2181e358193d fwd="174.45.175.167" dyno=web.1 connect=1ms service=3ms status=500 bytes=284 protocol=https 添加到我的 config.env,因此我的服务器无法访问我的环境变量来进行 API 调用。现在我想知道将它从 .gitignore 中取出是否会允许用户访问该文件,这是我不想要的。