1
votes

2020-07-21T06:54:58.030920+00:00 heroku[router]:

at=error code=H12
> desc="Request timeout"

method=GET path="/Recipies"

host=desolate-beach-26163.herokuapp.com request_id=25f963a1-ce9e-43c6-a054-72c8a7a33ea8 fwd="157.36.134.120" dyno=web.1 connect=1ms service=30001ms status=503 bytes=0 protocol=httpsenter code here

1

1 Answers

1
votes

The H12 "Request timeout" in Heroku is caused by long running actions. I'm not sure if you're pulling data from a database with this route, but this is a common issue when connecting to data sources from node.js on heroku.

First, check your database connection string, just to make sure that the configuration hasn't been affected. At the beginning of your app (server.js) you can log out the database URL:

console.log("Database_URL", process.env.DATABASE_URL);

After hitting the route (in your case, "/Recipies"), check the logs from your project's directory:

heroku logs --tail

Your connection string should look something like:

postgres://[email protected]:5432/aj48e4ewfjow34

If it doesn't, check your package.json, Procfile, and your index.js file for something that might overwrite DATABASE_URL.

You can verify the connection string by connecting via the "psql" command line tool with your url. It will look something like this (but replace the URL with your connection string) -

psql postgres://[email protected]:5432/aj48e4ewfjow34

If you can connect, it's probably an issue with the way that the postgresql library is being initialized. If you're using the latest "node-postgres" ("pg"), make sure that you have ssl rejectUnauthorized set to false:

const { Pool } = require('pg');
const pool = new Pool({
    connectionString: process.env.DATABASE_URL,
    ssl: { rejectUnauthorized: false }
});