question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error connecting to GCP cloud sql using ssl connection

See original GitHub issue

Got this error when trying to connect to GCP cloud sql using ssl connection

Error: P1011: Error opening a TLS connection: One or more parameters passed to a function were not valid.

My connection string following postgres connection guide and ssl identity following this issue

DATABASE_URL=postgresql://postgres:password@host:5432/insights?schema=insights-db&sslmode=require&sslcert=server-ca.pem&sslidentity=client-identity.p12&sslpassword=myidentitypassword

This error come out on both version “2.0.0-preview018.2” & “2.0.0-preview019”

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
ralvscommented, Sep 7, 2020

Hi, @pantharshit00 I confirm that I’m still facing this issue using prisma v2.6.2

I have just repeated the steps

  • created new server and client certificates at GCP console

  • openssl pkcs12 -export -out client-identity.p12 -inkey client-key.pem -in client-cert.pem

  • set database url to mysql://USER:PASSWORD@HOST:PORT/DATABASE?sslidentity=client-identity.p12&sslpassword=mypassword&sslcert=rootca.cert as described at https://www.prisma.io/docs/reference/database-connectors/mysql

  • npx prisma migrate save --experimental

And got the error Error: P1001: Can’t reach database server at x.x.x.x:3306

1reaction
pantharshit00commented, Jan 19, 2021

Hey all,

Can you please try rotating your certificate once? There was a similar issue which suggested this as a solution from the GCP docs: https://github.com/prisma/prisma/issues/4282#issuecomment-757477820

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure SSL/TLS certificates | Cloud SQL for MySQL
This page describes how to configure an instance to use SSL/TLS. ... SQL uses self-managed SSL/TLS certificates to securely connect to Cloud SQL...
Read more >
Unable to connect to CloudSQL instance using IP address if ...
1. Go to the "Access Control" page for the CloudSQL instance in the management UI. · 2. Check "Only allow SSL connections" on...
Read more >
Trouble Connecting To Postgres (Google Cloud SQL) with SSL
Failed to establish connection. Error: The remote certificate is invalid according to the validation procedure. I do have an active server SSL cert....
Read more >
Enable SSL/TLS for Cloud SQL Incoming Connections
Enforce all incoming connections to your Cloud SQL database instances to use SSL/TLS only. If the SSL/TLS protocol is not enforced for all ......
Read more >
How to connect to Google Cloud SQL with enforced SSL from ...
The easiest way to work around this problem is to write the cert file yourself into /tmp - this is a ramdisk in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found