Connection SSL/TLS
I'm trying to introspect my database from planetscale but when I run the command I get an error of:
Ignoring invalid configuration option passed to Connection: ssl{'rejectUnauthorized':true}. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
C:\Users\rober\code\projects\drizsup\node_modules\drizzle-kit\index.cjs:35618
Error: unknown error: Code: UNAVAILABLE
server does not allow insecure connections, client must use SSL/TLS.
I got the string from planetscale under node.js connection. I also tried sslaccept=strict.
String here:
DATABASE_URL='mysql://cmbv6127rur27iela7w8:[password]@aws.connect.psdb.cloud/prispractice?ssl={"rejectUnauthorized":true}'
Config file:
import type { Config } from "drizzle-kit";
export default {
schema: "./src/lib/schema.ts",
out: "./src/lib/db",
driver: "mysql2",
dbCredentials: {
connectionString: "mysql://cmbv6127rur27iela7w8:[password]@aws.connect.psdb.cloud/prispractice?ssl{'rejectUnauthorized':true}",
},
} satisfies Config;
What would be the fix?
It would be nice since the error tells you its invalid that it show valid options to choose from.
4 Replies
I believe you're not supposed to use single quotes in the connection string. See this thread: https://discord.com/channels/1043890932593987624/1143915838240469022
Thanks for the direction. I found a solution using url encoding: %7B%22rejectUnauthorized%22%3Atrue%7D. I dont think its the best solution but it works. Do you know how you would do it without using single quotes?
This is one way: `mysql://cmbv6127rur27iela7w8:[password]@aws.connect.psdb.cloud/prispractice?ssl{"rejectUnauthorized":true}`
this too: 'mysql://cmbv6127rur27iela7w8:[password]@aws.connect.psdb.cloud/prispractice?ssl{"rejectUnauthorized":true}'
another: "mysql://cmbv6127rur27iela7w8:[password]@aws.connect.psdb.cloud/prispractice?ssl{\"rejectUnauthorized\":true}"
Last one is escaping with \
Ah okay, so you just cant use single quotes within the string. I didn't get that till seeing it for some reason. Thank you for your help!