Unable to invoke prisma mutation to planetscale dev branch.

Dev branch was created on planetscale and the env variables are set to dev branch values.
npx prisma db push
npx prisma db push
works fine and succeeds. Looking at planetscale the new tables/fields are created but when I go to try to invoke the prisma mutation I get the error:
❌ tRPC failed on upload.uploadData:
Invalid `prisma.order.create()` invocation:


Error querying the database: Server error: `ERROR HY000 (1105): unavailable: unable to connect to branch BRANCH_NAME_HERE'
❌ tRPC failed on upload.uploadData:
Invalid `prisma.order.create()` invocation:


Error querying the database: Server error: `ERROR HY000 (1105): unavailable: unable to connect to branch BRANCH_NAME_HERE'
Also for whatever reason in the console on planetscale it says there's a syntax error when typing:
SELECT * FROM Mytable;
SELECT * FROM Mytable;
Any idea what's going on?
Solution:
(restarting the application again after
npx prisma db push
npx prisma db push
)
Jump to solution
11 Replies
Kev
Kev2y ago
Did you try to use the PlanetScale proxy for Prisma?
Entaro
EntaroOP2y ago
Probably not. Not sure where to set that up.
Kev
Kev2y ago
It's more or less the instructions here: https://planetscale.com/docs/prisma/automatic-prisma-migrations. You basically use the PlanetScale CLI to connect to your branch and change the DATABASE_URL to use the connection Not sure if that would solve your issue 100%, but that's how I typically use PlanetScale + Prisma and have never had issues with mutations
Entaro
EntaroOP2y ago
Alright, I'll give that a shot. I was briefly skimming that while trying to figure things out. I was following along with Theo's T3 tutorial, but he doesn't implement anything with a separate dev environment or use the planetscale cli so wasn't sure if I needed to go that route.
Kev
Kev2y ago
Yeah the ERROR HY000 (1105): unavailable: unable to connect to branch BRANCH_NAME_HERE is a little suspect so not sure
Entaro
EntaroOP2y ago
I replaced the actual branch name for security reasons.
Kev
Kev2y ago
Yeah, I just mean if your push succeeded then the query failing is a bit weird
Entaro
EntaroOP2y ago
Right? That's what's got me so confused.
Kev
Kev2y ago
Did you happen to change your ENV file after you had started the application?
Entaro
EntaroOP2y ago
I restarted the application and the issue persists. Sigh, thought I did. Just tried again and now it works. facepalm
Solution
Entaro
Entaro2y ago
(restarting the application again after
npx prisma db push
npx prisma db push
)
Want results from more Discord servers?
Add your server