Next.js Discord

Discord Forum

Prisma fails to connect during.

Unanswered
Flemish Giant posted this in #help-forum
Open in Discord
Flemish GiantOP
Hi, Im using next.js 14 with prisma on backend. This bug is weird cuz on one pc eveything works perfectly but here on my main pc, prisma throws this errors few times ( for 17 pages its 17 errros cuz im fetching a lot from database).

I've reinstalled modules, generated, migrated prisma and I'm stuck there. Here is photo from cli build operation.

P.S: On dev mode everything works as expected

63 Replies

What's the database you're trying to connect to?
Flemish GiantOP
PostgreSQL
Running locally?
Flemish GiantOP
on hosting
Which hosting? Supabase?
Flemish GiantOP
nazwa.pl
i mean in cmd database responses
Did you check the connection string?
Maybe you can share it. Please make sure to deleted the credentials first
Flemish GiantOP
ive copied same .env file from other pc where its workin
Ok, got it
Flemish GiantOP
It's also not firewall since ive turned it off for a moment
Can you try asding a connection timeout to the connection string?
So adding a URL parameter like connect_timeout=300 for example
Flemish GiantOP
im just addin &connect_timeout=300 ?
Yes
Flemish GiantOP
Ok, I gotta see your connection string. Please remove any credentials or sensitive data
Flemish GiantOP
DATABASE_URL="postgresql://[username]:[pass]@[hostname]:[port]/
Nothing after the slash?
Flemish GiantOP
ive deleted this
Oh, got it. But usually it says the name of your database, right?
Flemish GiantOP
connect_timeout=300 ?
i believe its hosting issue
The schema should be postgresql://[USER]:[PASSWORD]@[HOST]:[PORT]/[DATABASE]
Flemish GiantOP
it points me without database name since its database per account
anyway if it was the case it wouldnt be working on other pc
@Flemish Giant Click to see attachment
Here it seemed to have connected successfully
Flemish GiantOP
sec
They should have a name according to the [Nazwa documentation](https://www.nazwa.pl/pomoc/baza-wiedzy/zarzadzanie-baza-danych/#zmiana-hasla-uzytkownika-postgre)
Flemish GiantOP
i've added it and stil the same output
Which same output? Can you show the error?
Flemish GiantOP
same without timeout
but diffrent with
And your connection string looks like what atm?
Flemish GiantOP
postgres://[USER]:[PASSWORD]@[HOST]:[PORT]/[DATABASE]?connect_timeout=300
Can you try postgresql again in the beginning? Maybe it's that
Flemish GiantOP
i do have that actually xd
instead of postgres
Ah lol ok got it
Flemish GiantOP
didnt change it sorry
All good
Leave it like that
And without the connect_timeout it's the usual "Can't reach database server at..."?
Flemish GiantOP
yes
@Flemish Giant just a question, are you using a VPN?
Flemish GiantOP
not that i know of xd
Flemish GiantOP
:thinq:
Flemish GiantOP
@ncls. hi, seems like adding &connection_limit=5 worked
@Flemish Giant <@602953499407286331> hi, seems like adding &connection_limit=5 worked
Western thatching ant
when it build I think u connect it to other servers slow and made it timed out
:shrug:
@Flemish Giant what do you mean
Western thatching ant
it is local hosted?
i mean the database
@Flemish Giant nazwa.pl
Western thatching ant
oh
then if the server far away from that, it will be super slow
like if you are in US
connect to Vietnam
thats high latency
US to US is fast