Knex Timeout acquiring a connection
Hi all,
I'm having a bit of trouble establishing the minimum requirements needed to launch the server using the startServer
method directly. I have a simple test project (coko-server-test) with a minimal config that resolves to:
{
pubsweet: {
components: [ '/workspace/coko-server-test/config/components/ping.js' ]
},
'pubsweet-server': {
host: 'localhost',
port: 3000,
secret: 'NOT_A_SECRET',
db: {
user: 'postgres',
host: 'localhost',
database: 'test',
password: 'postgres',
port: 5432
}
},
authsome: { mode: '/workspace/coko-server-test/config/authsome.js' }
}
I can connect to the running database launched from a docker-compose.yml using these credentials. Everything seems to be going ok at first with the reported output:
Registered component /workspace/coko-server-test/config/components/ping.js
Coko server => Registering graphql middleware...
Starting HTTP server App is listening on port 3000
(node:9550) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.
Please migrate your code to use AWS SDK for JavaScript (v3). For more information, check the migration guide at https://a.co/7PzMCcy (Use
node --trace-warnings ...
to show where the warning was created)
But after a few seconds, I get a timeout error from knex:
Trace: KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
at Object.raw (/workspace/coko-server-test/node_modules/knex/lib/util/make-knex.js:114:30)
at Function.value (/workspace/coko-server-test/node_modules/knex/lib/util/make-knex.js:90:29)
at Object.executeSql (/workspace/coko-server-test/node_modules/pubsweet-server/src/jobs/index.js:19:17)
at Contractor.isInstalled (/workspace/coko-server-test/node_modules/pg-boss/src/contractor.js:31:34)
at Contractor.start (/workspace/coko-server-test/node_modules/pg-boss/src/contractor.js:36:34)
at PgBoss.start (/workspace/coko-server-test/node_modules/pg-boss/src/index.js:91:27)
at start (/workspace/coko-server-test/node_modules/pubsweet-server/src/jobs/index.js:57:14)
at Function.app.onListen (/workspace/coko-server-test/node_modules/@coko/server/src/app.js:166:13)
at startServer (/workspace/coko-server-test/node_modules/@coko/server/src/startServer.js:44:23)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at ExpressServer.start (/workspace/coko-server-test/apps/server/src/server.ts:28:19)
at main (/workspace/coko-server-test/apps/server/src/main.ts:7:3) {
sql: "SELECT to_regclass('pgboss.version') as name",
bindings: {},
originalStack: 'KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?\n' +
' at Client_PG.acquireConnection (/workspace/coko-server-test/node_modules/knex/lib/client.js:348:26)\n' +
' at Contractor.isInstalled (/workspace/coko-server-test/node_modules/pg-boss/src/contractor.js:31:20)\n' +
' at Contractor.start (/workspace/coko-server-test/node_modules/pg-boss/src/contractor.js:36:23)\n' +
' at PgBoss.start (/workspace/coko-server-test/node_modules/pg-boss/src/index.js:91:5)\n' +
' at start (/workspace/coko-server-test/node_modules/pubsweet-server/src/jobs/index.js:57:3)\n' +
' at Function.app.onListen (/workspace/coko-server-test/node_modules/@coko/server/src/app.js:166:7)\n' +
' at startServer (/workspace/coko-server-test/node_modules/@coko/server/src/startServer.js:44:3)\n' +
' at ExpressServer.start (/workspace/coko-server-test/apps/server/src/server.ts:28:19)\n' +
' at main (/workspace/coko-server-test/apps/server/src/main.ts:7:3)'
}
at /workspace/coko-server-test/apps/server/src/main.ts:12:11
Is there anything I need in my config or elsewhere to launch the server?
Thanks for your time!