Connection Terminated Unexpectedly

Wappler Version : 4.0.4
Operating System : W10
Server Model: NodeJS
Database Type: PostgreSQL
Hosting Type: Docker

Actual behavior

We encountered a 500 error with “connection terminated unexpectedly” error from knex, when trying to access a website we worked on the previous day.
Refreshing the page got rid of the error for rest of the day.
On searching, discovered that this is a known bug with Knex & PostgreSQL: https://github.com/knex/knex/issues/3523
We have been able to reproduce this reliably in two of our projects.

How to reproduce

The issue here is that when the NodeJS server remains idle for 1hr or more, the first request after that duration always returns a DB error.
Because we are using server side data SA, we always see an error.

One of the solutions provided talk about setting pool configuration to min:0. I haven’t tried poking around in Wappler files to check if this works.
If this work-around could be added to Wappler as well, it would be great. If not, can someone please direct me to the file where I can set it?

Well if you can try and confirm that min:0 works, we can see if we can add it.

@George

Bump. @George / @patrick

Well you can just edit your db connection in code and add it in the connection properties:

1 Like