-
Notifications
You must be signed in to change notification settings - Fork 16
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
This does not work with node 20 #91
Comments
A simple fix for this is adding |
Verified -- setting NODE_TLS_REJECT_UNAUTHORIZED to 0 works! Thanks!!!
…On Jan 8 2024, at 9:14 pm, Christopher Aitken ***@***.***> wrote:
> on the first attempt i get error:
> self-signed certificate in certificate chain
> There after it just silently fails on making a call to a database.
> The same code works perfectly fine from node 18 in aws lambda environment, but if I deploy the same code as node 20 -- database stops working.
A simple fix for this is adding NODE_TLS_REJECT_UNAUTHORIZED as an Environment Variables and setting it to 0.
—
Reply to this email directly, view it on GitHub (#91 (comment)), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAADOIK6GD2XEZDA2X5FXJTYNSRXPAVCNFSM6AAAAABBRTWOV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBSGE4TAOJQGY).
You are receiving this because you authored the thread.
|
No problem! |
@dmitryame Sorry for the extremely late reply. Is this still a problem? |
Thanks for replying, I'm assuming the problem still exists, I've been masking it with NODE_TLS_REJECT_UNAUTHORIZED, which I agree is not ideal, but works. If you could release a patch -- that would be the right thing to do and really awesome!
Thank you.
…On Apr 12 2024, at 2:37 am, Matteo Gioioso ***@***.***> wrote:
@dmitryame (https://github.com/dmitryame) Sorry for the extremely late reply. Is this still a problem? NODE_TLS_REJECT_UNAUTHORIZED=0 is not the best if you want to run in production. I can push a fix as soon as I have time.
—
Reply to this email directly, view it on GitHub (#91 (comment)), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAADOIIXFK4Q7PKB5N3OTO3Y456MFAVCNFSM6AAAAABBRTWOV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJRGA4DMMBUHA).
You are receiving this because you were mentioned.
|
@dmitryame sure, I will push a patch latest tomorrow, if I can find a way to fix it |
Let me know when you do -- I can help testing it.
…On Apr 16 2024, at 7:11 am, Matteo Gioioso ***@***.***> wrote:
@dmitryame (https://github.com/dmitryame) sure, I will push a patch latest tomorrow, if I can find a way to fix it
—
Reply to this email directly, view it on GitHub (#91 (comment)), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAADOIO2CK6GTFHUOFTLRVDY5UBOFAVCNFSM6AAAAABBRTWOV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJYHAZTKNJSGA).
You are receiving this because you were mentioned.
|
Hello again, If the problem persists try to open an issue on node-pg: https://github.com/brianc/node-postgres New version should be up: |
Just upgraded all my dependencies to the latest, including pg: 8.11.5 -- still does not work without the flag for me.
…On Apr 17 2024, at 7:50 am, Matteo Gioioso ***@***.***> wrote:
Hello again,
unfortunately I have realized that this could be tricky to test. On my machine with node v20 the tests run without errors.
I have just updated all the dependencies, in the hope this will fix your problem, now is using pg: 8.11.5.
If the problem persists try to open an issue on node-pg: https://github.com/brianc/node-postgres
—
Reply to this email directly, view it on GitHub (#91 (comment)), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAADOIM4MPDHUECRP3GGR5DY5ZOXHAVCNFSM6AAAAABBRTWOV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRRGA3TOOJRGA).
You are receiving this because you were mentioned.
|
Dammit =) |
Sorry, not entirely sure what would I need to do to switch to node-pg.
…On Apr 18 2024, at 4:02 am, Matteo Gioioso ***@***.***> wrote:
Dammit =)
Could you please try to test the same setup using directly node-pg?
—
Reply to this email directly, view it on GitHub (#91 (comment)), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAADOILNZLUVMVO5M3YTZCTY554YNAVCNFSM6AAAAABBRTWOV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRTGI3DIMRVHA).
You are receiving this because you were mentioned.
|
There should be not much to do, this library is a wrapper around node-pg, it uses pretty much the same API except for https://node-postgres.com/apis/client#new-client const pg = require('pg')
const { Client } = pg
const client = new Client({
host: 'my.database-server.com',
port: 5334,
database: 'database-name',
user: 'database-user',
password: 'secretpassword!!',
});
const handler = async (event, context) => {
await client.connect();
const result = await client.query(`SELECT 1+1 AS result`);
// await client.clean(); COMMENT this out
return {
body: JSON.stringify({ message: result.rows[0] }),
statusCode: 200
}
} There is also an ongoing issue that I found: brianc/node-postgres#2558 |
It seems like there's a bug with the node-postgres library when running in Node 20 that leads to SSL errors: MatteoGioioso/serverless-pg#91 Node 18 seems to always work fine though 👍
on the first attempt i get error:
self-signed certificate in certificate chain
There after it just silently fails on making a call to a database.
The same code works perfectly fine from node 18 in aws lambda environment, but if I deploy the same code as node 20 -- database stops working.
The text was updated successfully, but these errors were encountered: