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 }
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…