Search code examples
herokuinternal-server-error

Heroku gives a server error for my API but no error code


Here is the log I receive when I send a GET request.

2021-03-14T08:05:34.522724+00:00 heroku[router]: at=info method=GET path="/api/courses" host=shielded-meadow-94057.herokuapp.com request_id=0ff2b784-7dcc-421c-ae29-46ee9cc442ff fwd="73.222.178.14" dyno=web.1 connect=1ms service=52ms status=500 bytes=851 protocol=https

The only error I get is

GET https://shielded-meadow-94057.herokuapp.com/api/courses 500 (Internal Server Error)

Can you please share a way to fix it and receive my data?


Solution

  • Well, turns out I had to set the correct SSL flag for Heroku.

    const pg = require('pg');
    pg.default.ssl = process.env.NODE_ENV === "production";