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

Fixing SSL Error for local dev #37

Merged
merged 3 commits into from
Feb 23, 2024
Merged

Fixing SSL Error for local dev #37

merged 3 commits into from
Feb 23, 2024

Conversation

Kinfe123
Copy link
Contributor

it can now sync for both remote and local db conn string for mysql and easily portable to pg

Copy link

vercel bot commented Feb 22, 2024

Someone is attempting to deploy a commit to a Personal Account owned by @iamtouha on Vercel.

@iamtouha first needs to authorize it.

Copy link

vercel bot commented Feb 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
t3-lucia-starter ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 23, 2024 9:14am

@Fr3akyMurk
Copy link
Contributor

Fr3akyMurk commented Feb 22, 2024

Actually going crazy.
These changes causes:

Error: connect ETIMEDOUT
    at createConnection2 (/home/mark/next-lucia-auth/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:44322:35)
    at connectToMySQL (/home/mark/next-lucia-auth/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:61903:64)
    at Command.<anonymous> (/home/mark/next-lucia-auth/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:63065:28) {
  code: 'ETIMEDOUT',
  errno: undefined,
  sqlState: undefined
}

This is a completely fresh download with your new changes.
(db:push)
Linux Mint (ubuntu 22.xx)

@Kinfe123
Copy link
Contributor Author

Can you show me the db that you have created locally

@Fr3akyMurk
Copy link
Contributor

Fr3akyMurk commented Feb 22, 2024

Can you show me the db that you have created locally

Elaborate, how do you want me to show it?

@Kinfe123
Copy link
Contributor Author

the mysql db that you have created locally

@iamtouha
Copy link
Collaborator

it also causes error when running pnpm run db:studio to inspect the database.

 Invalid input  Either "connectionString" or "host", "database" are required for database connection
 ELIFECYCLE  Command failed with exit code 1.

@Fr3akyMurk
Copy link
Contributor

it also causes error when running pnpm run db:studio to inspect the database.

 Invalid input  Either "connectionString" or "host", "database" are required for database connection
 ELIFECYCLE  Command failed with exit code 1.

I got a similar something something error but i don't know how i got it.

@Fr3akyMurk
Copy link
Contributor

the mysql db that you have created locally

Are you asking for the connectionstring?
DATABASE_URL='postgresql://postgres:POSTGRES@localhost:5432/lucia?ssl={"rejectUnauthorized":false}'

@Kinfe123
Copy link
Contributor Author

image
this is mine but you have to make sure you are passing the necessary env var for that and make sure to use mysql://user:password@localhost:3306/lucia where lucia is the db that u will be creating CREATE DATABASE lucia; with in the mysql shell command

@Kinfe123
Copy link
Contributor Author

the mysql db that you have created locally

Are you asking for the connectionstring? DATABASE_URL='postgresql://postgres:POSTGRES@localhost:5432/lucia?ssl={"rejectUnauthorized":false}'

this is pg , u have to change the driver to pg and install pg to to use pg as your primary db

@Fr3akyMurk
Copy link
Contributor

Fr3akyMurk commented Feb 22, 2024

the mysql db that you have created locally

Are you asking for the connectionstring? DATABASE_URL='postgresql://postgres:POSTGRES@localhost:5432/lucia?ssl={"rejectUnauthorized":false}'

this is pg , u have to change the driver to pg and install pg to to use pg as your primary db

Tried with MariaDB (mysql) too, doesn't work regardless.
With Maria i get HANDSHAKE_NO_SSL_SUPPORT

@Kinfe123
Copy link
Contributor Author

Try this one -mysql://user:password@localhost:3306/lucia can you go create a db with mysql dialect , and with mysql driver as well using this format ...

@Kinfe123
Copy link
Contributor Author

have u tried by checeking out thir pr branch

@Kinfe123
Copy link
Contributor Author

to avoid version conflit issue

@Fr3akyMurk
Copy link
Contributor

What?
Yes i know how to switch connection strings based on db's
Yes i have checked out this pr branch, there are no conflicts.

@Kinfe123
Copy link
Contributor Author

Kinfe123 commented Feb 22, 2024

hmm.. this is just a simple thing fix .. like first it was not working for mee but now it is working fine but let other tried it and may be ur firewall or any proxy chaining issue may hang up HANDSHAKE's and other connection pull/push

@Fr3akyMurk
Copy link
Contributor

Fr3akyMurk commented Feb 22, 2024

hmm.. this is just a simple thing fix .. like first it was not working for mee but now it is working fine but let other tried it and may be ur firewall any proxy issue may hang up HANDSHAKE's and other connection pull/push

My firewall is inactive.
I never said it was inactive, i apologize.

On both systems, UFW is disabled.

@Fr3akyMurk
Copy link
Contributor

I'll try switch to pg drivers.

@Kinfe123
Copy link
Contributor Author

Kinfe123 commented Feb 22, 2024

hmm....lemme try it out by my vm's

@Kinfe123
Copy link
Contributor Author

@iamtouha can you also please test it ?

@Fr3akyMurk
Copy link
Contributor

Switch to sqlite :trollface:
No but i don't understand what the issue may be.
I have combed through sql, pg, neon etc etc and i get the same errors.

maybe it's the drizzle version?

@Fr3akyMurk
Copy link
Contributor

interesting, i got pg to somewhat work, problem is when i run pnpm db:push i get "No changes detected" despite the fact that my pg server has no tables.

@Kinfe123
Copy link
Contributor Author

Switch to sqlite :trollface: No but i don't understand what the issue may be. I have combed through sql, pg, neon etc etc and i get the same errors.

maybe it's the drizzle version?

yeah i have told u that earlieer to make sure we are on the same version to avoid conflits ..

@Kinfe123
Copy link
Contributor Author

interesting, i got pg to somewhat work, problem is when i run pnpm db:push i get "No changes detected" despite the fact that my pg server has no tables.

Does it applies the changes

@Fr3akyMurk
Copy link
Contributor

Switch to sqlite :trollface: No but i don't understand what the issue may be. I have combed through sql, pg, neon etc etc and i get the same errors.
maybe it's the drizzle version?

yeah i have told u that earlieer to make sure we are on the same version to avoid conflits ..

Yes and i told you there were no conflicts, i am talking about this projects drizzle version.

@Fr3akyMurk
Copy link
Contributor

interesting, i got pg to somewhat work, problem is when i run pnpm db:push i get "No changes detected" despite the fact that my pg server has no tables.

Does it applies the changes

No, it changes nothing.

@Fr3akyMurk
Copy link
Contributor

Interesting, i reinstalled the project and reconfigured everything.
I still get ssl errors (ssl wrong version number) however db:push now does things and it is reflected on my db.
however using the project is still a no go because of that ssl error.

@Kinfe123
Copy link
Contributor Author

Kinfe123 commented Feb 23, 2024

let me try reproducing the issue

@Kinfe123
Copy link
Contributor Author

Kinfe123 commented Feb 23, 2024

@Fr3akyMurk try using pnpm drizzle-kit push:mysql for pushing and pnpm drizzle-kit studio for studio since wee dont need to load the env since it is already on our root folder using dotenv ... and share the result based on the above pr

@iamtouha iamtouha merged commit e70e266 into saasykits:main Feb 23, 2024
4 checks passed
@iamtouha
Copy link
Collaborator

I think the root cause of the problem is, drizzle config differs depending on the database driver. In new version, drizzle-kit provides defineConfig function for defining config object. for pg driver, use connectionString and for mysql2 driver, use uri. hopefully, it'll solve the issue.

@iamtouha
Copy link
Collaborator

Here is the documentation for dbCredentials object for different databases and drivers- https://orm.drizzle.team/kit-docs/config-reference

@Fr3akyMurk
Copy link
Contributor

Fr3akyMurk commented Feb 23, 2024

@iamtouha Not too sure, i think it could be related to planetscales drivers because i read up on it and planetscale itself does not offer any way to connect to "bring your own" mysql server but rather it connects via http / https to a mysql server via proxy rather than mysql://

@iamtouha
Copy link
Collaborator

Have you tried separately putting all parameters?
image

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

Successfully merging this pull request may close these issues.

3 participants