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

Update on this: The pool setting did not make any difference. Still see the terminated error.
@patrick Any ideas? I checked the linked post again, but did not find anything else that might help with the issue.
Have not figured out any work-around as well so far.

This has been fixed in Wappler 4.6.4

@Teodor can you confirm if you have actually created a NodeJs project with PostgreSQL db and checked if the given solution works?
I have done this before, and as informed it did not work. Other posts on the linked Github issue suggest the same.

We’ve added connection pooling options in the UI in latest update. I thought that was your problem.

No. I also wrote the same thing in the new topic that was created a few days ago.

This topic was automatically closed after 47 hours. New replies are no longer allowed.