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

Local Connection Fails #104

Closed
techgerm opened this issue Apr 10, 2023 · 8 comments
Closed

Local Connection Fails #104

techgerm opened this issue Apr 10, 2023 · 8 comments

Comments

@techgerm
Copy link

Scenario

  1. I run pscale connect galaxy --port 3309 locally to connect to my PlanetScale DB
  2. I attempt to connect my T3 app using import { connect } from "@planetscale/database";

Problem

  1. When I use url to connect to my local db connection, it does not use the specified port - instead is uses port 443:
const connection = connect({
  url: "mysql://root@127.0.0.1:3309"
});

Screenshot 2023-04-09 at 8 13 19 PM

  1. When I use host & username to connect to my local db connection, it uses the correct port but it fails with a ERR_SSL_WRONG_VERSION_NUMBER status code
const connection = connect({
  host: "127.0.0.1:3309",
  username: "root"
});

Screenshot 2023-04-09 at 8 12 30 PM

I'd love to be able to use this package instead of prisma for my next project.

Anything that can be done to help here would be greatly appreciated!

@mattrobenolt
Copy link
Member

mattrobenolt commented Apr 10, 2023 via email

@techgerm
Copy link
Author

@mattrobenolt thanks for the quick response and clarification!
In that case, do you know how I can specify a DB branch in this configuration?

@mattrobenolt
Copy link
Member

When you create credentials, they're bound to a branch. So you'd just create credentials for the branch you want, and it'll work. Are you observing something differently?

@techgerm
Copy link
Author

Ah that's my mistake, didn't realize that was the case. Thanks again for your help!

Out of curiosity, are there any future plans to bridge the protocols?

@mattrobenolt
Copy link
Member

Bride them how? I have some plans. 👀 But curious what you have in mind.

@techgerm
Copy link
Author

Hmm let me give it some thought and I'll get back to you!

@Jolg42
Copy link

Jolg42 commented Aug 14, 2023

(Maybe unrelated to your issue? Feel free to ignore)

From what I see, the ERR_SSL_WRONG_VERSION_NUMBER error is caused because fetch tries to do some SSL logic here on a non SSL endpoint.

Changing these 2 lines and switching https to http should make it work.

const url = new URL('/psdb.v1alpha1.Database/Execute', `https://${this.config.host}`)

const url = new URL('/psdb.v1alpha1.Database/CreateSession', `https://${this.config.host}`)

@janpio
Copy link

janpio commented Aug 21, 2023

Related: #135

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

4 participants