Closed pnck closed 1 year ago
Can't you just add the pgbouncer param to your connection string?
Can't you just add the pgbouncer param to your connection string?
I did. I have finished deploying by manually overwrite DATABASE_URL
environment with the connection string provided by vercel db, instead of using vercel's builtin env injecting feature.
It's just somehow frustrating that you can't deploy it fully automatically. Not a big deal, I admit.
Hi @pnck, Neon developer (the service backing Vercel Postgres) here. Happy to help. The issue looks more like prisma migrate should not be using pgbouncer in the connection string. pgbouncer does not support prepare statements for now and may lead to unexpected errors. You should specify something like directUrl
in Prisma schema to use the URL in DATABASE_URL_NON_POOLING
and connect to Vercel Postgres, or remove the all pgbouncer parameters and switch to URLs without pooler
in all fields when you develop your project locally.
On our side, we are working on support for prepare statements in pgbouncer, and probably at some time in the future, you do not need to manually specify the non-pooling URL. But for now, when using prisma migrate, you will need to use a direct connection instead of pgbouncer :) should be fixed
Specifying DATABASE_PRISMA_URL
as the env variable used for Prisma schema should fix the problem. The URL should look like:
postgres://user:passwd@endpoint-pooler.postgres.vercel-storage.com/verceldb?pgbouncer=true&connect_timeout=10
The value can be changed in schema.prisma
.
I thought that's what OP did exactly. To me this issue seems more about suggesting checking DATABASE_PRISMA_URL
over DATABASE_URL
, otherwise umami would still prefer DATABASE_URL
which is automatically assigned by Vercel Postgres connection.
@Vinfall
@skyzh
To be honest I don't know much about prisma, so I don't know what arguments exactly should be passed in the envs. I just randomly tried and found it worked if I put the pgbouncer
there.
So my suggestion about checking another env might not be the optimal solution. Instructions newly added in the related PR also looks good to me.
Sure, I missed that. The PR appends the necessary params already so everything should be fine then.
I could be wrong but I am pretty sure this is not fixed and needs reopening (unless its been fixed in 2.6.0??). We are using the docker image of umami v2.5.0 with neon (not on vercel) and setting:
DATABASE_URL=......?pgbouncer=true&connect_timeout=10
Which is throwing:
✗ Command failed: prisma migrate deploy
Error: Schema engine error:
db error: ERROR: prepared statement "s0" does not exist
And the neon docs are stating that the directUrl needs setting in the schema.prisma - https://neon.tech/docs/guides/prisma-migrate
Is that correct @skyzh ? The directUrl still needs setting, you do not handle the migrates through pgbouncer=true ?
experimental support for prepared statements over pgbouncer is already in the prod IIRC, and therefore it is possible that you don't need pgbouncer=true
(which switches Prisma to work in a special pgbouncer mode in migration) to integrate with Neon. Anyways, it's always safer to add pgbouncer=true
+ directUrl as in the doc.
Describe the Bug
I'm trying to deploy umami into vercel with its new pg beta service, and I failed with these logs:
The vercel pg service automatically generate all these enviroments:
Note that
DATABASE_PRISMA_URL
contains thepgbouncer
parameter whileDATABASE_URL
not.As metioned in #1712 , I guess this missing paramater in
DATABASE_URL
leads to the error.I suggest to check
DATABASE_PRISMA_URL
overDATABASE_URL
to use a more detailed connection string.Database
PostgreSQL
Relevant log output
No response
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response