typeorm: `pg` < 8 causes node 14+ to crash
Issue type:
[ ] question [x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)
Steps to reproduce or a small repository showing the problem:
Today, homebrew updated my Mac to Node 14. My typeorm code immediately stopped working, and watching Little Snitch (extra firewall), I could see that node was not connecting in any way to the Postgres server. Dropping back to node 12 solved the issue.
I tried rebuilding the node_modules directory.
Anything else I can do to fix this locally?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 25
- Comments: 22 (4 by maintainers)
Commits related to this issue
- Bump pg package to stop typeorm hanging See https://github.com/typeorm/typeorm/issues/5949 — committed to SmartBear/git-en-boite by mattwynne 4 years ago
- Fix the build - upgrade pg package See https://github.com/typeorm/typeorm/issues/5949 — committed to SmartBear/git-en-boite by mattwynne 4 years ago
- FIx the silent crash on startup due to "pg@7" not being compatible with Node 14 (see https://github.com/typeorm/typeorm/issues/5949) — committed to sr-2020/nodejs-monorepo by aeremin 4 years ago
Oh, bumping to
pg@8.0.3looks like it fixes it!I can confirm this too. Program exits with code 0 during
createConnection. Downgrading to Node 12 has fixed it for me too.I recommend a downgrade to Node 12. In my case I was using node:alpine. A reversal to lts-alpine(which is node 12) fixed this for me. Took me 2 full days to find this issue.
Be wary ye typeorm travellers. Heed the words of @smber1 .
Thanks for sharing this.
Node 14 just became LTS. So anybody using
node:ltsdocker image (or defaulting Node version to “current LTS” in some other way will run into this.I’ve bumped the dev dependencies to 8.0.3 - perhaps we should also set peer dependencies for these as well so folks know what versions it’s compatible with?
However, I don’t think this is a typeorm problem - it’s a Postgres module (
pgmodule) problem.pg<8.0.3appears to be incompatible with node 14 because of some sort of changes. Upgrading to^8.0.3corrects thatI have the same issue even though I’ve upgraded to
pg@8.0.3. I’m using the latest version oftypeorm@0.2.24and the official14.1.0-alpinenode image. Reverting to node13.14.0-alpinefixes the issue.Weird thing is that it doesn’t exit or throw an exception, its just stuck awaiting the createConnection promise to resolve.
UPDATE: Turns out I had my pg version set to pg@^8.0.3 since 8.0.3 was a patch update and I had 8.0.0 installed in my docker container, my docker build didn’t update to 8.0.3 (instead staying at 8.0.0), removing my docker image and rebuilding fixed it.
It would be great if the TypeORM init command made sure to use
pg ^8.0.3if you are on node 14. Not sure if this is possible, but it is very confusing to run the server after init and get nothing.Geez ! I wasted so many hours on this. Thanks @smber1 for the solution, bumping to pg@8.0.3 solved it.
Same problem here, upgraded node from
13.8.0to14.2.0andcreateConnection()stopped working. Upgradedpgto version8.0.3solvedI just faced the same problem and upgrading
pgto8.5.1withnode 14.15.3also worked for me! I was searching a few hours already for the cause of the problem. Many thanks!This is actually what I was looking for. createConnection() was crushing my server without any error before I upgraded pg version to @8.0.3