Cannot reach your data error - increase timeout

Hello,

I was wondering, is there a way to increase the backend app timeout within .env ?
For very large tables, where sql query takes over few minutes, the app stops waiting for the results and closes the connection.
Within nginx proxy logs I’m seeing “upstream prematurely closed connection while reading response header from upstream”, upstream being the node server.

Thanks,
Marius

Hi @mar555,

Where does this timeout comes from (between you backend and your database/between your nginx and your backend?)? Both sequelize & express have customizable timeout

For express, timeout should be configurable directly on the server instance

const server = app.listen();
server.setTimeout(500000);

For sequelize, dialectOptions should contains a nested requestTimeout property

...
    dialectOptions: {
      options: {
        requestTimeout: 3000
      }
    },
...

Let me know if that helps

1 Like

Hi Jeff,

Thanks for your reply.

I’ve edited server.js to read:

server.listen(port); server.setTimeout(1800000);

It seems the timeout was happening between nginx and express server.

Further more on nginx side was necessary to add:

proxy_read_timeout 3600;

Thank you once more, saved the day :slight_smile:

Marius

1 Like