Skip to content
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

tutorial about prisma does not work #244

Open
coleea opened this issue Apr 25, 2023 · 3 comments
Open

tutorial about prisma does not work #244

coleea opened this issue Apr 25, 2023 · 3 comments

Comments

@coleea
Copy link

coleea commented Apr 25, 2023

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.

@tbarn
Copy link
Contributor

tbarn commented Apr 25, 2023

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.

@coleea
Copy link
Author

coleea commented Apr 25, 2023

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

@tbarn
Copy link
Contributor

tbarn commented Apr 26, 2023

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://root@127.0.0.1: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://root@127.0.0.1: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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants