Search code examples
heroku

Why Heroku server is not fetching APIs? (PERN stack)


I need help debug this problem. My app is in React, Node, Express and Postgres. I deployed it successfully on Heroku and the webpage showed static pages perfectly. But it went blank for the portion where it needs to fetch data from APIs. When I did Heroku logs, it gave me the error like below. Could anyone help me debug this problem?

2021-03-04T21:53:41.073745+00:00 app[web.1]: at addChunk (_stream_readable.js:309:12)
2021-03-04T21:53:41.073746+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:284:9)
2021-03-04T21:53:41.073746+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:223:10)
2021-03-04T21:53:41.073746+00:00 app[web.1]: at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
2021-03-04T21:53:41.073747+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-03-04T21:53:41.073997+00:00 app[web.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2021-03-04T21:53:41.074202+00:00 app[web.1]: (node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2021-03-04T21:53:41.774057+00:00 heroku[web.1]: State changed from starting to up
2021-03-04T21:54:14.053381+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/v1/games" host=nteract-games.herokuapp.com request_id=02a42e4d-25b9-48c2-acc5-6de49e004d26 fwd="49.36.161.255" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
2021-03-04T21:54:14.958989+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=nteract-games.herokuapp.com request_id=08805f36-0075-4a07-86f6-656dee3b408e fwd="49.36.161.255" dyno=web.1 connect=1ms service=57ms status=200 bytes=4179 protocol=https
2021-03-04T22:08:59.957742+00:00 heroku[router]: at=info method=GET path="/logo192.png" host=nteract-games.herokuapp.com request_id=63a022a5-3e96-486b-8e11-15f7e566b641 fwd="54.212.47.199" dyno=web.1 connect=1ms service=7ms status=200 bytes=5654 protocol=https
2021-03-04T22:44:57.037070+00:00 heroku[web.1]: Idling
2021-03-04T22:44:57.064406+00:00 heroku[web.1]: State changed from up to down
2021-03-04T22:45:00.490306+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-03-04T22:45:00.698397+00:00 heroku[web.1]: Process exited with status 143
2021-03-04T23:43:50.795940+00:00 heroku[web.1]: Unidling
2021-03-04T23:43:50.811189+00:00 heroku[web.1]: State changed from down to starting
2021-03-04T23:44:02.112382+00:00 heroku[web.1]: Starting process with command `node server.js`
2021-03-04T23:44:04.893222+00:00 app[web.1]: Server started on port 49627!
2021-03-04T23:44:04.893233+00:00 app[web.1]: 
2021-03-04T23:44:04.911897+00:00 app[web.1]: (node:4) UnhandledPromiseRejectionWarning: error: no pg_hba.conf entry for host "54.210.219.228", user "jlffntexskqxaf", database "d1dni4rrpqm6k3", SSL off
2021-03-04T23:44:04.911901+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
2021-03-04T23:44:04.911901+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2021-03-04T23:44:04.911903+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2021-03-04T23:44:04.911903+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2021-03-04T23:44:04.911905+00:00 app[web.1]: at Socket.emit (events.js:315:20)
2021-03-04T23:44:04.911905+00:00 app[web.1]: at addChunk (_stream_readable.js:309:12)
2021-03-04T23:44:04.911907+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:284:9)
2021-03-04T23:44:04.911908+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:223:10)
2021-03-04T23:44:04.911908+00:00 app[web.1]: at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
2021-03-04T23:44:04.911908+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-03-04T23:44:04.914751+00:00 app[web.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2021-03-04T23:44:04.914952+00:00 app[web.1]: (node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2021-03-04T23:44:05.498199+00:00 heroku[web.1]: State changed from starting to up
2021-03-04T23:44:06.470124+00:00 heroku[router]: at=info method=GET path="/" host=nteract-games.herokuapp.com request_id=45919086-26e2-4c1a-aff1-eda45e1f933e fwd="68.228.82.153" dyno=web.1 connect=1ms service=24ms status=200 bytes=2731 protocol=https
2021-03-04T23:44:06.584547+00:00 heroku[router]: at=info method=GET path="/static/css/main.5af4f64f.chunk.css" host=nteract-games.herokuapp.com request_id=8e202985-8dfb-474e-991e-1d89d39c5fc3 fwd="68.228.82.153" dyno=web.1 connect=1ms service=3ms status=200 bytes=2279 protocol=https
2021-03-04T23:44:06.618133+00:00 heroku[router]: at=info method=GET path="/static/js/2.8bd4d093.chunk.js" host=nteract-games.herokuapp.com request_id=6ca3ad78-5d12-4b6a-ac01-af1ad1e9384d fwd="68.228.82.153" dyno=web.1 connect=1ms service=28ms status=200 bytes=383646 protocol=https
2021-03-04T23:44:06.675395+00:00 heroku[router]: at=info method=GET path="/static/js/main.4cf487f4.chunk.js" host=nteract-games.herokuapp.com request_id=1d80558f-6431-4956-aee4-5dc42b8310d0 fwd="68.228.82.153" dyno=web.1 connect=1ms service=7ms status=200 bytes=45167 protocol=https
2021-03-04T23:44:06.744820+00:00 heroku[router]: at=info method=GET path="/" host=nteract-games.herokuapp.com request_id=70bd397b-af31-452b-bafb-1707c2b03a2e fwd="3.80.210.39" dyno=web.1 connect=0ms service=3ms status=200 bytes=2731 protocol=https
2021-03-04T23:44:06.782064+00:00 heroku[router]: at=info method=GET path="/logo192.png" host=nteract-games.herokuapp.com request_id=5a81f9b3-4dcc-4e63-b28e-542c2c794f4c fwd="3.237.171.154" dyno=web.1 connect=1ms service=2ms status=200 bytes=5654 protocol=https
2021-03-04T23:44:06.877220+00:00 heroku[router]: at=info method=GET path="/" host=nteract-games.herokuapp.com request_id=d515b78f-58ec-4bbf-8874-ae492f6b9513 fwd="3.234.144.228" dyno=web.1 connect=0ms service=3ms status=206 bytes=2778 protocol=https
2021-03-04T23:44:07.171785+00:00 heroku[router]: at=info method=GET path="/static/js/main.4cf487f4.chunk.js.map" host=nteract-games.herokuapp.com request_id=69fed97b-2746-4914-b977-be2668ef3b0f fwd="68.228.82.153" dyno=web.1 connect=1ms service=11ms status=200 bytes=69547 protocol=https
2021-03-04T23:44:07.176380+00:00 heroku[router]: at=info method=GET path="/logo192.png" host=nteract-games.herokuapp.com request_id=dc7e6a55-1b29-431e-bf77-fe46964afce9 fwd="34.214.111.232" dyno=web.1 connect=1ms service=3ms status=200 bytes=5654 protocol=https
2021-03-04T23:44:07.225223+00:00 heroku[router]: at=info method=GET path="/static/js/2.8bd4d093.chunk.js.map" host=nteract-games.herokuapp.com request_id=f4ec6f15-0c34-42ed-af11-e3a012a9b260 fwd="68.228.82.153" dyno=web.1 connect=1ms service=58ms status=200 bytes=971615 protocol=https
2021-03-04T23:44:07.273221+00:00 heroku[router]: at=info method=GET path="/manifest.json" host=nteract-games.herokuapp.com request_id=12931599-168f-473f-95d0-14f496f31942 fwd="68.228.82.153" dyno=web.1 connect=1ms service=4ms status=200 bytes=819 protocol=https
2021-03-04T23:44:07.290872+00:00 heroku[router]: at=info method=GET path="/logo192.png" host=nteract-games.herokuapp.com request_id=ce501ba5-8e6a-48bf-8ccd-b785c8a66e9d fwd="18.202.25.94" dyno=web.1 connect=1ms service=2ms status=200 bytes=5654 protocol=https
2021-03-04T23:44:07.354782+00:00 heroku[router]: at=info method=GET path="/static/media/turtles.7ea6de07.png" host=nteract-games.herokuapp.com request_id=7552a395-f657-40bf-ac50-b4844b90b843 fwd="68.228.82.153" dyno=web.1 connect=1ms service=3ms status=200 bytes=21948 protocol=https
2021-03-04T23:44:07.410937+00:00 heroku[router]: at=info method=GET path="/static/css/main.5af4f64f.chunk.css.map" host=nteract-games.herokuapp.com request_id=c7e4dc6a-ba09-473e-a09b-37dbf1c5e37e fwd="68.228.82.153" dyno=web.1 connect=1ms service=3ms status=200 bytes=4300 protocol=https
2021-03-04T23:44:07.552424+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=nteract-games.herokuapp.com request_id=53a16618-8367-48ca-ac19-7d339ce403b1 fwd="68.228.82.153" dyno=web.1 connect=1ms service=7ms status=200 bytes=4179 protocol=https
2021-03-04T23:44:07.553262+00:00 heroku[router]: at=info method=GET path="/manifest.json" host=nteract-games.herokuapp.com request_id=b37b12cf-e6e4-482b-9621-772e31d1389c fwd="68.228.82.153" dyno=web.1 connect=2ms service=9ms status=304 bytes=269 protocol=https
2021-03-04T23:44:07.649501+00:00 heroku[router]: at=info method=GET path="/logo192.png" host=nteract-games.herokuapp.com request_id=6edc1a66-ac52-4837-b9d8-43378c27a0c3 fwd="68.228.82.153" dyno=web.1 connect=1ms service=3ms status=200 bytes=5654 protocol=https
2021-03-04T23:44:37.183194+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/v1/games" host=nteract-games.herokuapp.com request_id=113762b3-be0c-4ac2-aa11-dc37b3218194 fwd="68.228.82.153" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2021-03-04T23:44:37.335666+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/v1/tasks" host=nteract-games.herokuapp.com request_id=537069ed-4a83-4257-bcdb-0556b12b39f7 fwd="68.228.82.153" dyno=web.1 connect=1ms service=30001ms status=503 bytes=0 protocol=https
2021-03-04T23:52:11.484328+00:00 heroku[router]: at=info method=GET path="/" host=nteract-games.herokuapp.com request_id=cbd8eeec-35b3-4de4-a454-b3cd8210b515 fwd="68.228.82.153" dyno=web.1 connect=1ms service=3ms status=304 bytes=269 protocol=https
2021-03-04T23:52:11.614284+00:00 heroku[router]: at=info method=GET path="/static/css/main.5af4f64f.chunk.css" host=nteract-games.herokuapp.com request_id=acd6c458-f33f-46a6-957e-d539f91be93a fwd="68.228.82.153" dyno=web.1 connect=1ms service=3ms status=304 bytes=269 protocol=https
2021-03-04T23:52:11.622980+00:00 heroku[router]: at=info method=GET path="/static/js/2.8bd4d093.chunk.js" host=nteract-games.herokuapp.com request_id=6612dca1-351f-40ba-b520-a2d4d960bc29 fwd="68.228.82.153" dyno=web.1 connect=1ms service=7ms status=304 bytes=271 protocol=https
2021-03-04T23:52:11.697104+00:00 heroku[router]: at=info method=GET path="/static/js/main.4cf487f4.chunk.js" host=nteract-games.herokuapp.com request_id=cdbeb449-7314-4b61-bdbb-dd9adfb5c195 fwd="68.228.82.153" dyno=web.1 connect=1ms service=2ms status=304 bytes=270 protocol=https
2021-03-04T23:52:11.856163+00:00 heroku[router]: at=info method=GET path="/static/media/turtles.7ea6de07.png" host=nteract-games.herokuapp.com request_id=0323139b-e553-46f3-b310-b65f490b4f85 fwd="68.228.82.153" dyno=web.1 connect=1ms service=4ms status=304 bytes=270 protocol=https
2021-03-04T23:52:12.240896+00:00 heroku[router]: at=info method=GET path="/manifest.json" host=nteract-games.herokuapp.com request_id=7383108f-868f-4b10-951c-2ec0b3fe6fba fwd="68.228.82.153" dyno=web.1 connect=1ms service=5ms status=304 bytes=269 protocol=https
2021-03-04T23:52:12.342121+00:00 heroku[router]: at=info method=GET path="/logo192.png" host=nteract-games.herokuapp.com request_id=26d06480-6587-4689-9bd5-dd9762a5b08f fwd="68.228.82.153" dyno=web.1 connect=2ms service=5ms status=304 bytes=270 protocol=https
2021-03-04T23:52:41.848910+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/v1/games" host=nteract-games.herokuapp.com request_id=e20483a2-a40c-4cd0-853e-3a83abbbe4e3 fwd="68.228.82.153" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
2021-03-04T23:52:41.857343+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/v1/tasks" host=nteract-games.herokuapp.com request_id=f715ed11-468f-4441-acdf-e8a7b65e89d3 fwd="68.228.82.153" dyno=web.1 connect=2ms service=30000ms status=503 bytes=0 protocol=https
2021-03-04T23:54:20.482564+00:00 heroku[router]: at=info method=GET path="/" host=nteract-games.herokuapp.com request_id=d9fd649d-a11e-410b-ba7f-4dc7966f7a66 fwd="68.228.82.153" dyno=web.1 connect=1ms service=3ms status=304 bytes=269 protocol=https
2021-03-04T23:54:20.622682+00:00 heroku[router]: at=info method=GET path="/static/css/main.5af4f64f.chunk.css" host=nteract-games.herokuapp.com request_id=27075272-c9f6-4121-868d-e5676145f2fd fwd="68.228.82.153" dyno=web.1 connect=1ms service=2ms status=304 bytes=269 protocol=https
2021-03-04T23:54:20.627330+00:00 heroku[router]: at=info method=GET path="/static/js/2.8bd4d093.chunk.js" host=nteract-games.herokuapp.com request_id=b599d46a-5afd-43e4-876f-1b20bd37260b fwd="68.228.82.153" dyno=web.1 connect=1ms service=3ms status=304 bytes=271 protocol=https
2021-03-04T23:54:20.709402+00:00 heroku[router]: at=info method=GET path="/static/js/main.4cf487f4.chunk.js" host=nteract-games.herokuapp.com request_id=e20dfa9a-2790-4db0-8459-e0c3fb833868 fwd="68.228.82.153" dyno=web.1 connect=1ms service=2ms status=304 bytes=270 protocol=https
2021-03-04T23:54:20.871471+00:00 heroku[router]: at=info method=GET path="/static/media/turtles.7ea6de07.png" host=nteract-games.herokuapp.com request_id=f4fa7a17-0da0-4c1c-8983-8f6ace58a010 fwd="68.228.82.153" dyno=web.1 connect=2ms service=3ms status=304 bytes=270 protocol=https
2021-03-04T23:54:21.267283+00:00 heroku[router]: at=info method=GET path="/manifest.json" host=nteract-games.herokuapp.com request_id=2676a096-1f30-4b69-a4a2-db50a463cd36 fwd="68.228.82.153" dyno=web.1 connect=1ms service=2ms status=304 bytes=269 protocol=https
2021-03-04T23:54:21.355716+00:00 heroku[router]: at=info method=GET path="/logo192.png" host=nteract-games.herokuapp.com request_id=30618fa1-e31d-4112-8c96-5016efa6d735 fwd="68.228.82.153" dyno=web.1 connect=1ms service=3ms status=304 bytes=270 protocol=https
2021-03-04T23:54:50.868570+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/v1/games" host=nteract-games.herokuapp.com request_id=f874099a-875f-4e39-95f0-edb3d38160de fwd="68.228.82.153" dyno=web.1 connect=1ms service=30011ms status=503 bytes=0 protocol=https
2021-03-04T23:54:50.869152+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/v1/tasks" host=nteract-games.herokuapp.com request_id=ffa15ae5-92d2-4e52-a193-7397620e7508 fwd="68.228.82.153" dyno=web.1 connect=2ms service=30000ms status=503 bytes=0 protocol=https
2021-03-05T00:18:25.153805+00:00 heroku[router]: at=info method=GET path="/logo192.png" host=nteract-games.herokuapp.com request_id=8592c662-8dab-483d-aea6-384a4dbd2a00 fwd="52.211.163.136" dyno=web.1 connect=1ms service=10ms status=200 bytes=5654 protocol=https
2021-03-05T00:51:35.847518+00:00 heroku[web.1]: Idling
2021-03-05T00:51:35.850202+00:00 heroku[web.1]: State changed from up to down
2021-03-05T00:51:36.770090+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-03-05T00:51:36.894779+00:00 heroku[web.1]: Process exited with status 143
2021-03-05T01:04:39.125354+00:00 heroku[web.1]: Unidling
2021-03-05T01:04:39.248383+00:00 heroku[web.1]: State changed from down to starting
2021-03-05T01:04:47.571627+00:00 heroku[web.1]: Starting process with command `node server.js`
2021-03-05T01:04:49.520038+00:00 app[web.1]: Server started on port 17992!
2021-03-05T01:04:49.520052+00:00 app[web.1]: 
2021-03-05T01:04:49.527741+00:00 app[web.1]: (node:4) UnhandledPromiseRejectionWarning: error: no pg_hba.conf entry for host "18.212.217.163", user "jlffntexskqxaf", database "d1dni4rrpqm6k3", SSL off
2021-03-05T01:04:49.527742+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
2021-03-05T01:04:49.527742+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2021-03-05T01:04:49.527743+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2021-03-05T01:04:49.527743+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2021-03-05T01:04:49.527744+00:00 app[web.1]: at Socket.emit (events.js:315:20)
2021-03-05T01:04:49.527744+00:00 app[web.1]: at addChunk (_stream_readable.js:309:12)
2021-03-05T01:04:49.527745+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:284:9)
2021-03-05T01:04:49.527745+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:223:10)
2021-03-05T01:04:49.527746+00:00 app[web.1]: at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
2021-03-05T01:04:49.527746+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-03-05T01:04:49.527866+00:00 app[web.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2021-03-05T01:04:49.528003+00:00 app[web.1]: (node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2021-03-05T01:04:49.721930+00:00 heroku[web.1]: State changed from starting to up
2021-03-05T01:04:51.340564+00:00 heroku[router]: at=info method=GET path="/logo192.png" host=nteract-games.herokuapp.com request_id=618aa02a-aa62-468d-a058-8501f4258b46 fwd="52.37.199.84" dyno=web.1 connect=0ms service=22ms status=200 bytes=5654 protocol=https
2021-03-05T01:40:21.938163+00:00 heroku[web.1]: Idling
2021-03-05T01:40:21.944094+00:00 heroku[web.1]: State changed from up to down
2021-03-05T01:40:23.121294+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-03-05T01:40:23.257393+00:00 heroku[web.1]: Process exited with status 143

Solution

  • Heroku has a new requirement as of February 23, 2021: All Heroku Postgres client connections require SSL. We didn't get an email warning us about this before it happened, so our app suddenly went offline. I was able to fix it by making the following updates to our Heroku app config variables:

    • Set PGSSLMODE to require
    • Set DB_USE_SSL to true