Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

402
Views
H12 Heroku error when making POST request with Axios and React

I've made a React.JS app, which I've hosted on Netlify, which sends POST requests to a Node.JS server hosted on Heroku. Whenever I send a POST request, it works temporarily, but 30 seconds later it sends an H12 error. I've tried everything but nothing has seemed to work. The link to my client is here. My server code is the following:

const express = require('express');
const db = require("./config/db");
const app = express();
const bodyParser = require('body-parser');
const cors = require('cors');
const path = require('path');
const PORT = 3001;
const timeout = require('connect-timeout');

app.use((req, res, next) => {
    res.setHeader("Access-Control-Allow-Origin", "https://coruscating-dolphin-7548e8.netlify.app");
    res.header(
      "Access-Control-Allow-Headers",
      "Origin, X-Requested-With, Content-Type, Accept"
    );
    next();
  });
app.use(express.json())
app.use(bodyParser.urlencoded({extended: true}));
app.use(express.static(path.join(__dirname, "..", "build")));
app.use(express.static("public"));

app.post('/api/test', timeout('2s', {respond: false}), cors(), (req, res) => {
    console.log("test");
    console.log(req.body.test);
});

app.listen(process.env.PORT || PORT, () => {
    console.log(`running on port ${PORT}`);
});

Here is the error I keep getting in the browser.

And here it is in Heroku:

2022-04-24T23:02:29.132724+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/api/test" host=word-data-database.herokuapp.com request_id=2c39695c-e8ec-47c2-9940-e85ec3ccd450 fwd="65.189.245.250" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https

Note: I had POSTs and GETs that used my database, but I cut them out to test if they were the problem, they weren't. Any help would be appreciated!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!