kysely-org/kysely-postgres-js

Getting Cannot read properties of undefined (reading 'replace') error

Closed this issue · 4 comments

I am getting this error.
My setup is same as given in the readme example. I am using RDS proxy on AWS.

ERROR Uncaught Exception {"errorType":"TypeError","errorMessage":"Cannot read properties of undefined (reading 'replace')","stack":["TypeError: Cannot read properties of undefined (reading 'replace')"," at queryError (file:///var/task/packages/functions/src/my-lambda.mjs:807408:49)"," at errored (file:///var/task/packages/functions/src/my-lambda.mjs:807403:17)"," at Socket.error (file:///var/task/packages/functions/src/my-lambda.mjs:807395:5)"," at Socket.emit (node:events:517:28)"," at Socket.emit (node:domain:489:12)"," at emitErrorNT (node:internal/streams/destroy:151:8)"," at emitErrorCloseNT (node:internal/streams/destroy:116:3)"," at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"]}

Hey 👋

What node runtime are you using in your lambda?
What versions of kysely, postgres, kysely-postgres-js are you using?
Can you share a non-bundled stack trace?

What node runtime are you using in your lambda?
What versions of kysely, postgres, kysely-postgres-js are you using?
Can you share a non-bundled stack trace?

@igalklebanov

Node runtime: Node 18x
Versions:

"kysely": "^0.26.3",
postgres: 3.4.3
kysely-postgres-js: 2.0.0

Since I am using RDS proxy, I cannot connect from my localhost, and thus cannot generate the non-bundled stack trace.
I am using sst.dev framework for deployment.
My localhost postgres just work fine.

I also tried the postgres Dialact that comes in kysely. It's also having problem connecting to the RDS proxy.
That dialact is throwing the following error:
"Connection terminated unexpectedly".

and I found this github issue regarding same: brianc/node-postgres#2112

So I suspect it's something to do with the RDS proxy. but still, I could not find any solution.
If I remove RDS proxy and directly use RDS db, then it works fine.

If you faced something similar, and could help me, I would greatly appreciate. ^_^

SST projects are notorious for having multiple kysely versions installed. I suspect this is your issue. SST core uses kysely 0.25.x afaik. You could switch to pnpm/yarn or find a way to deduplicate your kysely dependency in node_modules.

This seems unrelated to this dialect.

SST projects are notorious for having multiple kysely versions installed. I suspect this is your issue. SST core uses kysely 0.25.x afaik. You could switch to pnpm/yarn or find a way to deduplicate your kysely dependency in node_modules.

Thanks for your reply. I will check that.