Prisma PG adapter error in hosted environments (`this.client.connect(...).catch is not a function`)
This is using 6.10.1 with
pg 8.16.1, pg-pool 3.10.1
The confusing thing is that this only occurs in the hosted environment on AWS ECS. I've tried building the container image and running it locally and it works just fine. This did not happen with @prisma/adapter-pg 5.22.0. I have tried it both with and without the new queryCompiler preview feature.
Is there anything I can do to reproduce this or narrow down the cause?3 Replies
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the
#ask-ai channel awaits if you're curious!Hey!
It would be very helpful if you can provide a minimal reproducible example for this issue.
I'll then be able to share it with team internally to investigate
I know this is months old, but I ran into the same issue after switching to
engineType = "client". I was seeing basically the same stack trace and it was only happening in AWS ECS.
For me the issue turned out to be caused by @opentelemetry/instrumentation-pg - it wraps the pg-pool connect method and I guess the wrapper can return a non-Promise which causes this line to throw: https://github.com/prisma/prisma/blob/6.16.2/packages/adapter-pg/src/pg.ts#L200 . It was only happening in ECS because I had instrumentation switched off in dev.
Removing the instrumentation resolved the issue for me.
If anyone else runs into this I would suggest looking to see if you have any auto- or pg-specific instrumentation switched on.