docs icon indicating copy to clipboard operation
docs copied to clipboard

tutorial about prisma does not work

Open coleea opened this issue 2 years ago • 3 comments

Which doc needs an update?

https://planetscale.com/docs/prisma/prisma-quickstart

What needs to be updated?

1 line summary : npx prisma db push does not work

when I run commands, it throws error

Error: Migration engine error:
unknown error: Code: UNAVAILABLE
server does not allow insecure connections, client must use SSL/TLS

I searched stackoverflow and found solution. the like is https://stackoverflow.com/questions/74830570/planetscaledb-prisma-setup-server-does-not-allow-insecure-connections-client

1 line solution summary : replace ssl={"rejectUnauthorized":true} to sslaccept=strict in DATABASE_URL of .env file

also, pscale connect star-app initial-setup --port 3309 is not needed.

coleea avatar Apr 25 '23 03:04 coleea

Hi @coleea!

There's two way to connect to PlanetScale in this situation:

  1. You can update your DATABASE_URL environment variable to use a Prisma specific URL which would look like DATABASE_URL='mysql://******:pscale_pw_*****@aws.connect.psdb.cloud/test-database?sslaccept=strict'. You can find this exact URL in the Connect modal on your database page in PlanetScale.
  2. Use pscale connect star-app initial-setup --port 3309 locally and connect through the pscale proxy. The tutorial follows closer to this way.

Which way were you trying? It seems like the first one if you mentioned not needing pscale connect command. Now rereading this, I think we could make some improvements, including laying out the two different ways. I would not say pscale connect star-app initial-setup --port 3309 is unneeded if you are using the pscale proxy way.

tbarn avatar Apr 25 '23 18:04 tbarn

I understand what you said. I tried second way that official tutorial offers.

What I want to say is that the proxy way causes errors. I did everything the tutorial told me to do, but I got an error

If you don't understand what I'm saying, do it yourself

I did it under windows 11

coleea avatar Apr 25 '23 22:04 coleea

Interesting...

It might be a Mac vs Windows issue that we haven't heard of before. I just tested:

  1. I added DATABASE_URL = 'mysql://[email protected]:3309/star-app' to my .env
  2. Ran pscale connect star-app initial --port 3309
  3. And then in a separate tab ran npx prisma db push and it pushed the schema to PlanetScale.

But if I do the same with DATABASE_URL = 'mysql://[email protected]:3309/star?sslaccept=strict', I get an error on the npx prisma db push. It might have to do with the SSL package that Mac has by default. We will look into it and might add a note for Windows specifically.

tbarn avatar Apr 26 '23 15:04 tbarn