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

Most upvoted comments

Oh, bumping to pg@8.0.3 looks 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:lts docker 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 (pg module) problem.

pg<8.0.3 appears to be incompatible with node 14 because of some sort of changes. Upgrading to ^8.0.3 corrects that

I have the same issue even though I’ve upgraded to pg@8.0.3. I’m using the latest version of typeorm@0.2.24 and the official 14.1.0-alpine node image. Reverting to node 13.14.0-alpine fixes 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.3 if 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.0 to 14.2.0 and createConnection() stopped working. Upgraded pg to version 8.0.3 solved

I just faced the same problem and upgrading pg to 8.5.1 with node 14.15.3 also 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