-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
pg client fails to connect (silently) using Node 14 #2317
Comments
+1 I noticed this too, reverting to nodev12.18.3 fixed the issue for me as well |
Your package.json has console.log(require('pg/package.json').version); |
Adding this line to the above TS file:
yields the following output:
|
How about on the current version of Node 14? FROM node:14.8.0-alpine3.12 |
Same result: > node -v
v14.8.0
> ts-node test-pg-client.ts
PG VERSION 8.3.2 (still unable to connect to a live postgres instance that is accessible via a different script which uses ES6 |
I have the same issue this is blocking me as I need to upgrade to node v14.4.0.
|
Update: |
I had this same issue with |
agreed - I can do this |
That's really strange, considering I have verified that I'm running PG 8.3.2 on Node 14 in a clean docker build (that is to say, no node_modules). |
@martinbliss Working for me in node 14.9 w/ the latest |
I failed to mention in my original post that I have a |
Node 14.0 made a bunch of backwards incompatible changes to streams that seemed to break quite a lot of libraries. I'd definitely avoid that version in general. They reverted the changes in 14.1, and the later releases are all fine. However, IIRC pg (once updated to v8) was not one of the libraries affected by this (at least for how we're using it). |
@brianc One thing that most people in the community are doing to avoid having node versions break streams is using https://github.com/nodejs/readable-stream instead of the core Not even sure if this is what is responsible for this particular issue - but I do see the |
@contra The issue with pg <8.0.3 was using a property that wasn’t part of the public API. I don’t think there’s anything like that left. |
Just adding a datapoint to this thread : we use in production pg 8.0.3 with nodejs 14.0.0 without any problem. |
@martinbliss Is it also broken when connecting to a PostgreSQL server running in another container, not just the host? |
Thank you guys. I ran into this issue with an older version (<8) and thought I did something wrong |
I don’t know, since I only run databases in containers.
…On Thu, Sep 3, 2020 at 1:18 PM Charmander ***@***.***> wrote:
@martinbliss <https://github.com/martinbliss> Is it also broken when
connecting to a PostgreSQL server running in another container, not just
the host?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2317 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC3FK5ZOESOMHRTBI5MACEDSD7MWRANCNFSM4QIYJ7KA>
.
|
@martinbliss Oh, I thought this was accessing a database on the host because of the |
No. I have a similar setup using docker-compose (where one container is
accessing Postgres in a different container inside the same network) and
the outcome is the same. I only chose to include the —network=host option
to make it easier to repro the issue without revealing non open-source code.
On September 5, 2020 at 11:26:09 PM, Charmander ([email protected]) wrote:
@martinbliss <https://github.com/martinbliss> Oh, I thought this was
accessing a database on the host because of the --network=host. Is there
any difference on a different, non-host network, then?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2317 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC3FK55XVQC3SILBR6TZPFDSEMFOBANCNFSM4QIYJ7KA>
.
|
has this been solved for people using containers? still having the same issue using pg 8.5.X |
@samueldaviddelacruz We are using node-Postgres now with node 14 in alpine and Debian containers. Upgrading to the latest version of node-Postgres solved the problem for us. |
@codyhazelwood exactly which version? im using this 14-alpine and it causing issues,pg version => "pg": "^8.5.1", this is my dockerfile: FROM node:14-alpine
WORKDIR "/app"
COPY ./package.json ./
RUN npm install
COPY . .
CMD ["npm","run","dev"]```
|
update: i fixed my issue by starting from scratch with my containers, deleted all the old images and containers and build them again, this fixed the issue on my side. |
I set up a VM to reproduce the steps from the original issue exactly, and the output was: /src # ts-node test-pg-client.js
/bin/sh: ts-node: not found I’m not sure if that’s something that changed in a dependency, but either way: /src # node_modules/.bin/ts-node test-pg-client.js
row value { '?column?': 1 } @martinbliss Are you still having an issue connecting from containers with Node 14? |
This was a real humdinger for me. I am using:
And the problem is now fixed. I was previously on 7.12.1 and same version of Node. |
I've noticed this too... I cant tell the huge amount of hours i've wasted trying to make my app work with node 14... Thanks in advance! |
reopen if so! |
This is why I don't like the Node JS Ecosystem |
yeah same , I uninstall pg and install pg version (^8.6.0) , and it works for me with node 15.14.0 |
The pg client seems to fail quietly when connecting to postgress when using Node 14.x. Tested using Docker.
Dockerfile
package.json
test-pg-client.ts
Since we're using Docker, let's build and run the image
(this runs the image with host network access, allowing you to connect to a postgres database that is running on the same machine. )
Expected Result (while inside the container):
❯ yarn install ❯ ts-node test-pg-client.ts row value { '?column?': 1 }
Actual Result:
(no errors, no messages, just nothing)
The behavior is remedied by changing the first line in Dockerfile to the following:
FROM node:12.18.3-alpine3.12 as builder
This behavior seems similar to #2180 but wasn't totally sure if the circumstances were the same, so chose to make a new issue just in case.
The text was updated successfully, but these errors were encountered: