hi! Does anyone know how to fix this error? I'm us...
# orm-help
p
hi! Does anyone know how to fix this error? I'm using Prisma Data Proxy and it fails to connect 😞
j
Hi @potatoxchip. Could you provide some extra information on your setup? Feel free to use DM if it is sensitive.
p
Copy code
generator client {
  provider = "prisma-client-js"
  previewFeatures = ["dataProxy"]
}

datasource db {
  provider = "mysql"
  url      = env("DATABASE_URL")
}

model views {
  id     Int    @id @default(autoincrement())
  ipHash String @db.VarChar(64)
  postId Int

  @@unique([ipHash, postId], map: "views_ipHash_postId_UNIQUE")
}

model posts {
  id          Int       @id @default(autoincrement())
  slug        String    @unique(map: "posts_slug_UNIQUE") @db.VarChar(50)
  description String    @db.VarChar(100)
  title       String    @db.VarChar(50)
  isPublished Boolean?  @default(false)
  createdAt   DateTime? @default(now()) @db.Timestamp(0)
  updatedAt   DateTime? @default(now()) @db.Timestamp(0)
}
this is my
prisma/prisma.schema
file
ive added the
<prisma://database|prisma://...
>url as
DATABASE_URL
in
.env
the data browser at cloud.prisma.io shows the data in my database just fine
also,
@prisma/client
and
prisma
version are
3.4.0
j
Cool, just checking a few things
p
this is the entire console log if it helps
j
So what I can see is that the engine failed to connect to your database.
It’s worth pointing out that currently Data Proxy and Data Browser will connect to your database from different addresses, in case you are using network ACLs.
p
I even tried to deploy it to vercel and there also it failed to connect
j
Yes. Note that the database connection is initiated from the Data Proxy.
p
Is this a problem from my end tho? I can't seem to narrow it down 😞
j
The engine logs indicate an issue connecting to your database, so that might be worth double checking.
p
aight i will try once with
<https://github.com/prisma/deployment-example-vercel/tree/data-proxy>
@Jacob D does prisma proxy work only with postgres?
i tried with a quick postgres project, and it works just fine
and when i used mysql, it fails to connect
j
Data Proxy supports the same connectors as regular Prisma.
Maybe double check the connection string you are using with mysql.
p
im using mysql from planetscale and my connection string has ?ssl_cert as well
j
Ah, right. I remember there being some weirdness with PlanetScale at some point. Let me check what the deal is there.
p
oh! aight you can ping me anytime! 👍
j
Right. I was able to diagnose this against a planetscale DB, and the issue was on indeed on our end. This should be patched across all Data Proxy regions shortly. Thanks for reporting, and lemme know if you are stuck
p
Thanks for the confirmation!! Well i am stuck with this, but it is not a big issue. I will fallback to using postgres in the meanwhile and then migrate to mysql when this is resolved
Also, do i need to open a github issue for this?
j
Assuming we were observing the same issue with PlanetScale, this should be resolved for you ( at least in us-east , as eu-central is currently updating ) .
For issues with the Data Proxy, this channel, or #prisma-data-platform are likely to have the best response time.
p
aight. i am using us-east, let me check it once
j
Ah, I see what the issue with your setup is. You are explicitly passing
?sslcert
which tries to name a path. That isn’t going to work - however, omitting that param should unblock you, as that will cause the engine to fall back to our managed CA certs.
p
ok let me change that in cloud.prisma.io
the dashboard shows "The database is not reachable"
<mysql://username:password@host:3306/db>
my connection string looks like this without
?sslcert
i checked the connection string in datagrip and it connected with the db, but prisma fails 😞
j
Hmm. I updated my project with a fresh connection string and that is working correctly. I did that by updating the Connection string under Database in Environment Settings in cloud.prisma.io for my project.
I’d suggest creating/importing a new project using planetscale mysql to double check. Please let me know If that issue persists, so we can have folks who work on the web app have a look when they’re in the office tomorrow.
p
i just made a new planetscale db and still cloud.prisma.io wont connect. If you want, i can share you the connection string
Yo!! we got it working now! turns out the issue was that i needed to set
?sslaccept=strict
thanks for your help @Jacob D 😸
j
Ah, awesome. Happy days