New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client error "Can't reach database" for some tables not others #853
Comments
with DEBUG="*"
|
Using the schema you posted above, I can successfully |
yes i've tried it with both. Please let me know if there's any more information i can provide prisma-studio-error.mp4. |
You could create a small script based on https://github.com/prisma/prisma-examples/blob/latest/javascript/script/script.js and then replace the queries in there with just this one:
This seems to be the failing one from your logs - and I wonder what happens if you execute that manually against that database. If it also fails, that would upgrade your problem from Prisma Studio to Prisma ORM overall. |
i can run this query from my app (nextjs) and display the results in a test page. Also i can see the table data in dBeaver
|
Can you please run the exact query that Studio runs? |
Aha! Yes that exact query generates the same error:
Here's the query code:
|
When i comment out posts: true, it works |
I manually dropped and recreated the relations tables , and now it seems to work :) I had migrated the database from an older framework so maybe something was corrupted. Thanks for your patience. |
All good, happy we could figure it out 🚀 |
The problem came back when testing with my full sized database. I've recreated it in my own code. There are thousands of posts tagged with a topic. I dont know if Prisma offers a way to limit the "take" on relations, but i think that's the problem. This query works:
This query fails, as above:
It includes a relation query on posts with the following clause:
This query works:
Maybe Prisma Studio should query for count rather than all the relation records. |
Just to confirm: Does this also crash when you run that exact query on the production database via a script? |
yes |
Can you please open an issue over at https://github.com/prisma/prisma/issues/ then and describe the issue, optimally in a way that makes it reproducible for us? Does not seem to be a Studio only problem then. Thanks. |
ok. But it is a Studio problem b/c you could/should change your query to get relation count instead of all the relation records. |
Closing this in favour of prisma/prisma#8832, please see this comment. |
We have closed the original issue in |
Prisma version (
prisma -v
ornpx prisma -v
):3.9.2
Logs from Developer Tools Console or Command line, if any:
Does the issue persist even after updating to the latest
prisma
CLI dev version? (npm i -D prisma@dev
)YES
Prisma schema (if relevant):
In Prisma Studio, i can open some tables (eg Post, Attachment) but two other tables -- Topic and Location -- give the error " Invalid
prisma.location.findMany()
invocation: Can't reach database server atlocalhost
:5432
"I've tried this in browser running
npx prisma studio
(in a NExt.js project) and also same errors in Prisma Studio Desktop (Windows 10).I'm able to query the same tables within my app ok.
I've tried this with several different Postgres databases that share the schema, eg a local development, a cloud preview (on AWS) and a cloud production (on DigitalOcean), same errors. I've tried uninstalling and reinstalling prisma and @prisma/client, deleting my Appdata/Roaming/Prisma/Studio/ folder and other thing.
See video:
https://www.loom.com/share/3b73f7230dbe4550b73810643a719f66
The text was updated successfully, but these errors were encountered: