Replies: 8 comments 13 replies
-
Hi @laplab , thanks for making this a discussion. Appreciated if you could provide any suggestions. |
Beta Was this translation helpful? Give feedback.
-
Hi @franva Thank you for raising this question? Can you access your database using a GUI tool like TablePlus using the Database connection string you are currently using? |
Beta Was this translation helpful? Give feedback.
-
Hi @ludralph and @laplab , I have added my |
Beta Was this translation helpful? Give feedback.
-
Hi @ludralph and @laplab , I finally have made it working by pasted in the hard copy of the connection string directly into the So it seems that it is the |
Beta Was this translation helpful? Give feedback.
-
Again i can run my project locally only. I have a very similar issue only that my instance only works locally. When i use same exact env config in Vercel the pages of the project that make database requests just dont load. |
Beta Was this translation helpful? Give feedback.
-
Hi guys, I found that this issue comes from loading correct value of environment variables. |
Beta Was this translation helpful? Give feedback.
-
@franva Did you solve the issue? If so, could you share the solution here? I've been trying to figure it out for hours and still not solve. |
Beta Was this translation helpful? Give feedback.
-
I had the same problem in Google Cloud AlloyDB using Prisma as mentioned by @franva and @Aslam97. |
Beta Was this translation helpful? Give feedback.
-
Bug description
I was debugging my Next.js project with Prisma as my ORM. Everything was working fine. I logged into the dashboard page which lists all products from the Vercel Postgres database by using Prisma client.
Out of sudden, Prisma stopped working and no data can be fetched, basically any operations via Prisma error out. Here is an error example:
I have not changed anything in the .env or .env.local files, I did not even open those 2 files. So I opened the Vercel website, and copied the database connection strings again and put it into these 2 environment config files,
(I replaced the real password with in this post, but the real env files have the correct password which I copied from Vercel without any change).
Also copied the code for use in Prisma's schema file like below:
Also I just notice that I can pull my db schema from the Vercel PostgreSql database, this means the database connection string actually works. The issue could come from Prisma.
Also, I am able to launch the Prisma Studio and see all the data. So this is for sure the issue from
PrismaClient
.How to reproduce
.env
file and pasted in the code snippetschema.prisma
npx prisma db pull
andnpx prisma generate
,Expected behavior
I expect it to work as previously.
Prisma information
Environment & setup
Prisma Version
Update 1
Not sure whether it is useful to help solve the issue, but here is my
package.json
file.Update 2
I just found that if I pasted in the connection string into the
schema.prisma
like below and re-runnpx prisma generate
, it start to work.So now I suspect that the
env()
method does not work inschema.prisma
file.How to fix this issue?
Beta Was this translation helpful? Give feedback.
All reactions