Sphorb
Sphorb
DTDrizzle Team
Created by Sphorb on 11/26/2023 in #help
server does not allow insecure connections, client must use SSL/TLS
I have been trying to setup planetscale database with drizzle in my next js application. But I cant seem to form a conneciton with the database and push my generated schema up. When I run the command npx drizzle-kit push:mysql I get this error
const createConnectionErr = new Error();
Error: unknown error: Code: UNAVAILABLE
server does not allow insecure connections, client must use SSL/TLS
const createConnectionErr = new Error();
Error: unknown error: Code: UNAVAILABLE
server does not allow insecure connections, client must use SSL/TLS
this is what my drizzle.config.ts looks like
import { Config } from "drizzle-kit";

import * as dotenv from "dotenv";

dotenv.config({
path: ".env.local",
});

export default {
schema: "./database/schema.ts",
driver: "mysql2",
dbCredentials: {
host: process.env.DATABASE_HOST!,
user: process.env.DATABASE_USERNAME!,
password: process.env.DATABASE_PASSWORD!,
database: "database-name",
},
out: "./drizzle",
} satisfies Config;
import { Config } from "drizzle-kit";

import * as dotenv from "dotenv";

dotenv.config({
path: ".env.local",
});

export default {
schema: "./database/schema.ts",
driver: "mysql2",
dbCredentials: {
host: process.env.DATABASE_HOST!,
user: process.env.DATABASE_USERNAME!,
password: process.env.DATABASE_PASSWORD!,
database: "database-name",
},
out: "./drizzle",
} satisfies Config;
I have also tried using uri instead of host user password and database but that doesn't work either with the ?sslaccept=strict and other variations for it. Tried a bunch of solutions with this but nothing works. Other working repos online have older versions of drizzle-kit and drizzle-orm My versions are
drizzle-kit: v0.20.4
drizzle-orm: v0.29.0
drizzle-kit: v0.20.4
drizzle-orm: v0.29.0
Any help with this? Appericiate you guys looking at this! many thanks
3 replies