0

I am writing a full stack program in NodeJS, using Heroku and Postgresql. When I try to make a request through Heroku it times out. Here are the Heroku logs:

2021-04-14T23:39:01.483427+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/folders" host=damp-everglades-28835.herokuapp.com request_id=7bcfc1a9-bb04-4618-bc1b-211dcedf57c3 fwd="68.81.3.154" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
2021-04-14T23:39:01.489279+00:00 app[web.1]: GET /folders - - - - ms

At first, I tried to use pg version 8.x.x and it would not build. I would get this error: Self signed certificate error, using pg 8.XX. Version 8 won’t even deploy

    Package pg version 8.x.x not tested
    Please raise issue to support pg > 7.x.x
    [7:31:53 PM] table schemaversion does not exist - creating it.
    [7:31:53 PM] version of database is: 0
    [7:31:53 PM] migrating up to 2
    Error: self signed certificate
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1 

Searching for this error suggested adding ssl: false and here is my Postgrator.config where I tried that:

```require('dotenv').config();
module.exports = {
    "migrationsDirectory": "migrations",
    "driver": "pg", 
    "connectionString": process.env.DATABASE_URL,
    ssl: {
        rejectUnauthorized: false
      }
}```

SO, To try to fix it I downgraded to 7.4.3 and am stuck with this timeout error.

I can connect to, and modify the database directly. The backend's endpoints that do not use the database work correctly. I have triple-checked the credentials on Heroku.

Using: Node.js Heroku, javaScript, postgres

1 Answer 1

2

You can switch back to pg 8..

Your connection config should include ssl.required = true like

.......
        ssl: {
            required: true,
            rejectUnauthorized: false
          }
........
Sign up to request clarification or add additional context in comments.

1 Comment

You, sir, saved me hours of time. This simple change fixed an unbelievably painful error. Thank you so much.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.