Not able to connect from Next.js Vercel appp
HI Everyone we are facing a strange issue with our Next.js app where we when try to connect to NEON from our deployment or do a insert operation it fails with
with SS attached Message whereas on local everything works perfectly fine honestly after being baffled for good 6 hours we have lost it any idea how to navigate the same
our connection .ts
any help would be appreciated
thank you

9 Replies
generous-apricot•16mo ago
neondb seems to not be the name of your database
perhaps you set it to something else
robust-apricotOP•16mo ago
Yes the db name is set to something else and the url contains the same
But I don't know where this is picking neon_db
generous-apricot•16mo ago
can you paste your POSTGRES_URL without the password
dependent-tan•16mo ago
and the last part in your connection string would be /neondb which needs to be changed to your db name
dependent-tan•16mo ago
you can pick the relevant string by selecting db in neon's console

robust-apricotOP•16mo ago
sure here is the dev and qa url Please note we are getting this issue in both dev and qa
dependent-tan•16mo ago
And does the role
cred_dev_user and cred_qa_user roles have priviledges to insert data?robust-apricotOP•16mo ago
Hi everyone,
Thank you all for your suggestions and support. It turns out that the issue was due to an environment variable mismatch on Vercel. Our local .env files had the correct POSTGRES_URL, but the environment variables on Vercel were not properly set, leading to the database connection errors.
We have updated the environment variables in Vercel with the correct database URLs, and everything is now working as expected. Thank you for pointing us in the right direction and helping us resolve this issue!
Best regards,
NInjajinja
dependent-tan•16mo ago
Glad it's resolved!