Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to run migrations when using Node v14.5.0 causes "KnexTimeoutError" #3912

Closed
fdjones opened this issue Jul 5, 2020 · 11 comments
Closed

Comments

@fdjones
Copy link

fdjones commented Jul 5, 2020

Environment

Node: 14.5.0
npm: 6.14.5

Knex version: 0.21.1
Database + version: PostgresQL 12.3
OSX: Catalina

Bug

When attempting to run migrations, the following error occurs:

KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
    at Client_PG.acquireConnection (/Users/me/Code/project/node_modules/knex/lib/client.js:347:26)
    at async Promise.all (index 1)

When I revert my Node version to 12.18.2 the migrations run fine, so the issue is running the migrations while on Node 14.5.0.

@ShawnStewart
Copy link

ShawnStewart commented Jul 6, 2020

I'm running into this same issue with my docker-compose setup.

Environment

Node: 14.5.0
Knex: 0.21.1
Node-postgres (pg): 8.2.1

Issue

Attempting to run migrations or a simple query inside of my node container results in the following error:

npx knex migrate:latest or await db.raw('select 1+1 as result');

Using environment: development
KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
    at Client_PG.acquireConnection (/app/node_modules/knex/lib/client.js:349:26)

Reverting to Node 12.18.2 does not resolve the issue for me and I'm still unable to even run migrations.

I tried reverting Node-postgres (pg) per these issues, but still no luck.

Any help is greatly appreciated!

@fdjones
Copy link
Author

fdjones commented Jul 6, 2020

@ShawnStewart Are you still seeing the same error when you try to run migrations after you revert to Node 12.18.2 or is it a different error? I had an issue where I installed the packages using Node 14.xx which caused a load of issues after I reverted and the only way to fix it was to nuke node_modules and re-install while using Node 12.xx.

@ShawnStewart
Copy link

ShawnStewart commented Jul 7, 2020

@fdjones Sorry, I pasted the wrong error in my original comment - fixed it now. I'm getting the exact same error as you. And since I'm running in docker, I can do a rebuild and a fresh install of dependencies is done.

@ShawnStewart
Copy link

@fdjones Just tested outside of docker. After reverting to Node 12.18.2 and fresh installing dependencies, still getting the same error. Are you connecting to Postgres running locally?

@fdjones
Copy link
Author

fdjones commented Jul 7, 2020

Hmm, that's odd as reverting to Node 12 fixed the issue for me. Yes I'm running Postgres locally..

@rbliss
Copy link

rbliss commented Jul 10, 2020

Experienced the same issue. Fixed it by upgrading both knex and pg to latest instead of downgrading to Node 12. YMMV

@ShawnStewart
Copy link

Confirmed upgrading resolved the issue for me as well. It looks like pg 8.3.0 fixed the root cause.

@rbliss Thanks for the heads up!

@gates17
Copy link

gates17 commented Jul 25, 2020

having the same issue under wsl. tried with pg 8.3 and knex 0.21.1 switched to mysql2 and throws same error.
tried with node12 node 14.5 and 14.7
any insights?

@fdjones
Copy link
Author

fdjones commented Jul 27, 2020

@gates17 did you try dropping down to node 12, deleting node_modules and then re-installing your dependencies?

@gates17
Copy link

gates17 commented Jul 27, 2020

as i said before tried with the node versions quoted below.
i did however manage to run my current configurations under ubuntu20.04 vmware with mysql2 yesterday. but i still get the pool connection error on 1st connection try which is awkward.
still i dont remember having made any installation that would mess up the pooling on both dbs under windows or wsl.

having the same issue under wsl. tried with pg 8.3 and knex 0.21.1 switched to mysql2 and throws same error.
tried with node12 node 14.5 and 14.7
any insights?

@almeidaalex
Copy link

almeidaalex commented Jan 31, 2021

Confirmed upgrading resolved the issue for me as well. It looks like pg 8.3.0 fixed the root cause.

@rbliss Thanks for the heads up!

Thank you a lot! I don't have too much experience with node environment (I'm reading a book that uses node examples). I've just upgraded pg package to 8.4 and the error stopped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants