a year ago
I’ve been having a lot of problems with PgBouncer and Postgres. I have a backend that sends requests to an app hosted on Vercel, which uses serverless functions. After some connections, I start encountering a lot of errors.
I’ve already increased the number of connections to 1000 in Postgres and 2000 in PgBouncer, but I’m still experiencing the same issues.
39 Replies
a year ago
what makes you think you are running into connection limits?
well the erro in vercel says that the database is nto approchable no ?
a year ago
yeah but im not seeing anything that says you hit connection limits
a year ago
unless im blind?
a year ago
where do you see logs for connection limits?
well, I assumed it was a connection limit when Vercel showed me errors saying that I couldn't connect to the DB, that it was not reachable, and it only happens when I run a process that uses an API, and my understanding is that with Prisma it kind of creates one connection per serverless functions, if I run this locally it works because I have this , so it doesnt create one connection per request

a year ago
how many times is the serverless function being invoked?
a year ago
may i ask, why not run app thats currently on vercel, on railway?
well, it started on Vercel, the free tier is "enough" for what we do, if I move it to Railway, it will cost me, and my understanding is that I will lose the serverless
and i get deployments on each PR , (I dont know if i get this with railway) also i can comemnt on the ui of the preview deployments
I'm reading this https://github.com/orgs/vercel/discussions/4539
But I'm not sure https://github.com/prisma/prisma/discussions/23589
they said that using &connection_limit=1 worked for them, but my understanding is that if I do this, the pgBouncer is pointless, no?
a year ago
railway has both deploy from github pushes, and pr environments!
and you can always enable app sleep so your app goes to sleep and doesnt use any cpu / mem.
but above all, running your app on railway besides your database means that we wont have to charge you egress fees (as long as you use the private network)
also also, you wont need pgbouncer, so thats cost savings too
sounds interesting because i have another app and i think im not using the private network
a year ago
and who cna help me to migrate ?
you try to migrate, and if you get stuck, either me or another community member can help troubleshoot!
sounds interesting because i have another app and i think im not using the private network
its possible, you can open another thread for help with that
will i loose the serverless with nextjs correct?
yeah, railway is not serverless, though we do have app sleeping.
how does that work ?
if the app has to be running because it is a web app
your app runs 24/7
a year ago
a year ago
can't recommend it for anything other than a side project though
ok maybe i will try it so how will it work if it is not serverless, i will use for everything the same db connection?
also is there a way to help me to fix this issue ?
a year ago
why does it have to be serverless?
a year ago
what issue?
a year ago
i'm not sure about that, to fix it i had recommended running the app on railway
a year ago
Should be pretty simple
a year ago
use reference variables -
a year ago
!s
Status changed to Solved brody • about 1 year ago
