Error when running `drizzle-kit push:mysql` to a Planetscale database

so after reading through the Doc's it looks like i need an SSL cert to run the push however i'm not sure how to configure that with drizzle and from what i've sceen from others they are doing it an easier way. This is the error I get when running drizzle-kit push:mysql:
bash
> drizzle-kit push:mysql

drizzle-kit: v0.19.2
drizzle-orm: v0.27.0

No config path provided, using default 'drizzle.config.ts'
Reading config file 'G:\GitHub\Meally\apps\meally\drizzle.config.ts'
G:\GitHub\Meally\node_modules\.pnpm\drizzle-kit@0.19.2\node_modules\drizzle-kit\index.cjs:34259
const createConnectionErr = new Error();
^

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

at createConnection2 (G:\GitHub\Meally\node_modules\.pnpm\drizzle-kit@0.19.2\node_modules\drizzle-kit\index.cjs:34259:35)
at connectToMySQL (G:\GitHub\Meally\node_modules\.pnpm\drizzle-kit@0.19.2\node_modules\drizzle-kit\index.cjs:36340:60)
at Command.<anonymous> (G:\GitHub\Meally\node_modules\.pnpm\drizzle-kit@0.19.2\node_modules\drizzle-kit\index.cjs:51785:28) {
code: 'ER_UNKNOWN_ERROR',
errno: 1105,
sqlState: 'HY000'
}
bash
> drizzle-kit push:mysql

drizzle-kit: v0.19.2
drizzle-orm: v0.27.0

No config path provided, using default 'drizzle.config.ts'
Reading config file 'G:\GitHub\Meally\apps\meally\drizzle.config.ts'
G:\GitHub\Meally\node_modules\.pnpm\drizzle-kit@0.19.2\node_modules\drizzle-kit\index.cjs:34259
const createConnectionErr = new Error();
^

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

at createConnection2 (G:\GitHub\Meally\node_modules\.pnpm\drizzle-kit@0.19.2\node_modules\drizzle-kit\index.cjs:34259:35)
at connectToMySQL (G:\GitHub\Meally\node_modules\.pnpm\drizzle-kit@0.19.2\node_modules\drizzle-kit\index.cjs:36340:60)
at Command.<anonymous> (G:\GitHub\Meally\node_modules\.pnpm\drizzle-kit@0.19.2\node_modules\drizzle-kit\index.cjs:51785:28) {
code: 'ER_UNKNOWN_ERROR',
errno: 1105,
sqlState: 'HY000'
}
This is my config:
typescript
import 'dotenv/config';
import type { Config } from 'drizzle-kit';
import { env } from './env.mjs';

const config: Config = {
schema: './src/db/schemas/',
out: './src/db/migrations',
driver: 'mysql2',
dbCredentials: {
connectionString: env.DATABASE_URL,
},

};

export default config;
typescript
import 'dotenv/config';
import type { Config } from 'drizzle-kit';
import { env } from './env.mjs';

const config: Config = {
schema: './src/db/schemas/',
out: './src/db/migrations',
driver: 'mysql2',
dbCredentials: {
connectionString: env.DATABASE_URL,
},

};

export default config;
Does anyone know how i an connect to Planetscale with the latest version drizzle?
6 Replies
Neto
Neto3y ago
does your connection url ends with ssl={"rejectUnauthorized":true}? something like mysql://[[USERNAME]]:[[PASSWORD]]@aws.connect.psdb.cloud/[[DB]]?ssl={"rejectUnauthorized":true}
Jacob
JacobOP3y ago
i have this at the end of my url ?sslaccept=strict i tried removing that but i am still getting the same error
Neto
Neto3y ago
does it end with the ssl thing?
Jacob
JacobOP3y ago
What do you mean?
Neto
Neto3y ago
change from ?sslaccept=strict to ?ssl={"rejectUnauthorized":true}
Jacob
JacobOP3y ago
that worked thank you

Did you find this page helpful?