johnhenry_6889
johnhenry_6889
DTDrizzle Team
Created by Filip on 8/10/2024 in #help
Error: self-signed certificate in certificate chain
@playsonmac sorry not tried to integrate with supabase but should be similar, pretty sure they are aws rds under the hood. I would suggest just checking that you have the correct certificate for the correct region where the supabase instance is hosted. Also have you tried using non-url connection? so using host/passwoord etc.
export default defineConfig({
dialect: "postgresql",
// Pick up all our schema files
schema: ["./packages/src/**/*.sql.ts"],
out: "./packages/core/migrations/",
dbCredentials: {
host: Resource.host,
port: Resource.port,
user: Resource.username,
password: Resource.password,
database: Resource.database,
ssl: {
rejectUnauthorized: true,
ca: fs.readFileSync("path.to.pem.file").toString(),
}
}
});
export default defineConfig({
dialect: "postgresql",
// Pick up all our schema files
schema: ["./packages/src/**/*.sql.ts"],
out: "./packages/core/migrations/",
dbCredentials: {
host: Resource.host,
port: Resource.port,
user: Resource.username,
password: Resource.password,
database: Resource.database,
ssl: {
rejectUnauthorized: true,
ca: fs.readFileSync("path.to.pem.file").toString(),
}
}
});
10 replies
DTDrizzle Team
Created by Filip on 8/10/2024 in #help
Error: self-signed certificate in certificate chain
Hi ran into this issue as well a few times. Mostly worked though the issue would happen on new environment setups and when I had not run drizzle-kit generate & drizzle-kit migrate to set everthing up and it seem to work fine. Ran into the issue again when I updated my schema and had to do the migration again. Issue is related to the ssl connection and the DB refusing it. Not sure why it worked at the beginning. To resolve the issue permanently. In drizzle.config I added :
ssl: {
rejectUnauthorized: true,
ca: fs.readFileSync("path.to.pem.file").toString(),
},
ssl: {
rejectUnauthorized: true,
ca: fs.readFileSync("path.to.pem.file").toString(),
},
You can download the certificates from AWS (use the region you have the DB hosted). https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html#UsingWithRDS.SSL.CertificatesAllRegions Download and save the pem file for you region . fs.readFileSync point to location of file.
10 replies