Problem connecting to database
Answered
shadow posted this in #help-forum
shadowOP
Hey, im creating a website for company and that company sells products, so i implemented payload cms that manages the products available in the website, i set up a postgres connector using database url from supabase, on the local enviroment everything works perfectly, but when i pushed to vercel i got this error after compiling
so my question is, am i doing something wrong or vercel doesnt allow this?
ERROR: Error: cannot connect to Postgres. Details: connect ENETUNREACH 2600:1f18:2e13:9d09:6bad:c8cc:78ab:ceab:5432 - Local (:::0)
err: {
"type": "Error",
"message": "connect ENETUNREACH 2600:1f18:2e13:9d09:6bad:c8cc:78ab:ceab:5432 - Local (:::0)",
"stack":
Error: connect ENETUNREACH 2600:1f18:2e13:9d09:6bad:c8cc:78ab:ceab:5432 - Local (:::0)
at /vercel/path0/node_modules/pg-pool/index.js:45:11
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async d6 (/vercel/path0/.next/server/chunks/3913.js:179:19548)
at async Object.d3 [as connect] (/vercel/path0/.next/server/chunks/3913.js:179:19879)
at async tc.init (/vercel/path0/.next/server/chunks/3913.js:198:16173)
at async tm (/vercel/path0/.next/server/chunks/3913.js:198:18566)
at async n (/vercel/path0/.next/server/app/(app)/catalogo/page.js:1:6002)
at async a (/vercel/path0/.next/server/app/(app)/catalogo/page.js:1:6726)
"errno": -101,
"code": "ENETUNREACH",
"syscall": "connect",
"address": "2600:1f18:2e13:9d09:6bad:c8cc:78ab:ceab",
"port": 5432
}
⨯ Static worker exited with code: 1 and signal: null
Error: Command "npm run build" exited with 1
so my question is, am i doing something wrong or vercel doesnt allow this?
Answered by shadow
I has to use an connection string named transaction pooler because vercel doesnt support ipv6, only ipv4.
The connection string i was using was the direct connection which its not ipv4 compatible (unless you pay).
So the solution is, if you are hosting a project on vercel and using connection strings, use the transaction pooler because vercel doesnt support the other ones.
The connection string i was using was the direct connection which its not ipv4 compatible (unless you pay).
So the solution is, if you are hosting a project on vercel and using connection strings, use the transaction pooler because vercel doesnt support the other ones.
3 Replies
shadowOP
I has to use an connection string named transaction pooler because vercel doesnt support ipv6, only ipv4.
The connection string i was using was the direct connection which its not ipv4 compatible (unless you pay).
So the solution is, if you are hosting a project on vercel and using connection strings, use the transaction pooler because vercel doesnt support the other ones.
The connection string i was using was the direct connection which its not ipv4 compatible (unless you pay).
So the solution is, if you are hosting a project on vercel and using connection strings, use the transaction pooler because vercel doesnt support the other ones.
Answer
@shadow I has to use an connection string named transaction pooler because vercel doesnt support ipv6, only ipv4.
The connection string i was using was the direct connection which its not ipv4 compatible (unless you pay).
So the solution is, if you are hosting a project on vercel and using connection strings, use the transaction pooler because vercel doesnt support the other ones.
Oak apple gall wasp
Hey bro, how do you do that ? Can you share this part of code please ?