0

There is one specific route that times out.

const express = require("express");
const router = express.Router();

router.post("/route", postRoute);
... other routes

module.exports = router;

async function postRoute(req, res) {
  console.log("TEST");
  ...
  return res.json({success: true});
}

Within an EC2 instance the express app is started using forever NODE_ENV=production forever start -c "npx babel-node" index.js.

Using forever list we can find the log file, but this log file does not contain a log entry "TEST" as expected.

When making a request to [host]/rout (which misses 'e') tells us the route is not found. So we are certain our route is found, but does not execute any coding from the function postRoute as console.log("TEST") never gets executed...

  • Is there any log file within our EC2 instance that says why it is timing out?
  • Anyone has an idea how this is possible as this specific route works well locally, but not in production?

Using DEBUG=express:* within the start command shows the express:* debug logs:

  express:router dispatching POST /route +10s
  express:router query  : /route +1ms
  express:router expressInit  : /route +0ms
  express:router corsMiddleware  : /route +0ms
  express:router urlencodedParser  : /route +0ms
  express:router jsonParser  : /route +2ms
  express:router <anonymous>  : /route +123ms
  express:router result  : /route +0ms
  express:router <anonymous>  : /route +0ms
  express:router dispatching GET /health +5s
  express:router query  : /health +0ms

Here is the error path within the React client:

POST [host]/route 504(anonymous)    @   trycatch.ts:281
(anonymous) @   instrument.ts:309
(anonymous) @   xhr.js:177
e.exports   @   xhr.js:13
e.exports   @   dispatchRequest.js:50
Promise.then (async)        
c.request   @   Axios.js:61
(anonymous) @   bind.js:9
(anonymous) @   index.js:36
l   @   runtime.js:63
(anonymous) @   runtime.js:294
(anonymous) @   runtime.js:119
n   @   asyncToGenerator.js:3
u   @   asyncToGenerator.js:25
(anonymous) @   asyncToGenerator.js:32
(anonymous) @   asyncToGenerator.js:21
(anonymous) @   index.js:14
y   @   api.js:43
r.handleSubmit  @   GeneralLedgerAccounts.js:222
We  @   react-dom.production.min.js:52
Je  @   react-dom.production.min.js:52
(anonymous) @   react-dom.production.min.js:53
kn  @   react-dom.production.min.js:100
Tn  @   react-dom.production.min.js:101
(anonymous) @   react-dom.production.min.js:113
Fe  @   react-dom.production.min.js:292
(anonymous) @   react-dom.production.min.js:50
Rn  @   react-dom.production.min.js:105
Qt  @   react-dom.production.min.js:75
Zt  @   react-dom.production.min.js:74
t.unstable_runWithPriority  @   scheduler.production.min.js:18
Wi  @   react-dom.production.min.js:122
Ue  @   react-dom.production.min.js:292
Xt  @   react-dom.production.min.js:73
n   @   helpers.ts:87
Adriaan De Bolle
  • 225
  • 1
  • 3
  • 20

0 Answers0