Fix Knex connection on Docker Swarm/Caprover

@patrick can you apply this fix for NodeJS please:

options: {
        "pool": {
          "min": 0,
          "max": 10,
          "idleTimeoutMillis": 30000,
          "createTimeoutMillis": 30000,
          "acquireTimeoutMillis": 30000
        }
      }

I’m unsure if this has any unintended consequences, double-check the above parameters

Context: If you have a non-busy website, after 15 minutes of inactivity a 502 error will be thrown upon first hit due to dead SQL connection

You can add those options in the json for the connection

{
  "name": "db",
  "module": "dbconnector",
  "action": "connect",
  "options": {
    "client": "postgres",
    "connection": {
      "host": "{{$_ENV.DB_HOST}}",
      "port": "{{$_ENV.DB_PORT}}",
      "user": "{{$_ENV.DB_USER}}",
      "password": "{{$_ENV.DB_PASS}}",
      "database": "{{$_ENV.DB_NAME}}",
      "pool": {
        "min": 0,
        "max": 10,
        "idleTimeoutMillis": 30000,
        "createTimeoutMillis": 30000,
        "acquireTimeoutMillis": 30000
      }
    }
  }
}

Will accept this for the time being. Worried a future Wappler update might take it away or something

1 Like

FYI: this does not work.
You will still get the error. We have been seeing this for the past few months.

If you do see it working, I would be very interested in knowing if you have done anything else.

Will send you a PM, have an alternative idea that needs to be tested

If there’s anyone else interested feel free to PM me as well (it’ll eventually go public or fixed in Caprover once tested)

These options have been added to Wappler 4.6.4

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