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.

Data Platform: Cannot connect Prisma to Cockroach Serverless `Requested database check `reachable` failed`

See original GitHub issue

Bug description

Prisma won’t accept the connection string, example: postgresql://seb:rmhls-LrWm3I5oDi1aaGag@free-tier13.aws-eu-central-1.cockroachlabs.cloud:26257/defaultdb?sslmode=require&options=--cluster%3Drose-warthog-619

I have a strong suspicion on this being an SSL-related problem

How to reproduce

Create CockroachCloud cluster

  1. Go to https://cockroachlabs.cloud/clusters
  2. Click on Create Cluster
  3. Select Serverless
  4. Select cloud provider AWS
  5. Select region Frankfurt (eu-central-1)
  6. Leave spend limit at $0
  7. Enter cluster name Test123
  8. Note down the connection string

Create Prisma project

  1. Go to https://cloud.prisma.io/projects
  2. Click on New Project
  3. Fill in project name as Test123
  4. Select Create a repository
  5. Fill in repository name as Test123
  6. Click on Next
  7. Select template URL Shortener
  8. Click on Next
  9. Select Use my own database
  10. Enter connection string, in my case postgresql://seb:rmhls-LrWm3I5oDi1aaGag@free-tier13.aws-eu-central-1.cockroachlabs.cloud:26257/defaultdb?sslmode=require&options=--cluster%3Drose-warthog-619 [I will delete this cluster as soon as this problem is resolved]
  11. Select location eu-central-1 (Frankfurt)
  12. Leave static IPs on Disabled
  13. I get a warning, the complete information of it being We were unable to create your project: Requested database check `reachable` failed

Check connection string with psql

  1. Connect: psql "postgresql://seb:rmhls-LrWm3I5oDi1aaGag@free-tier13.aws-eu-central-1.cockroachlabs.cloud:26257/defaultdb?sslmode=require&options=--cluster%3Drose-warthog-619" -c "SHOW DATABASES"

Check connection string with cockroach sql

  1. Download certs with curl --create-dirs -o ~/.postgresql/root.crt -O https://cockroachlabs.cloud/clusters/32d83dc6-bfad-4146-9c1f-fbed298ce610/cert
  2. Connect: cockroach sql --url "postgresql://seb:rmhls-LrWm3I5oDi1aaGag@free-tier13.aws-eu-central-1.cockroachlabs.cloud:26257/defaultdb?sslmode=require&options=--cluster=rose-warthog-619&sslrootcert='$HOME'/.postgresql/root.crt" -e "SHOW DATABASES"

Expected behavior

It should allow a new Prisma project to connect to CockroachDB’s serverless offering

Prisma information

No schema, just trying to create a new and blank project

Environment & setup

  • Fedora 35 locally
  • Prisma Cloud
  • CockroachDB serverless

Prisma Version

prisma                  : 3.11.0
@prisma/client          : Not found
Current platform        : rhel-openssl-1.1.x
Query Engine (Node-API) : libquery-engine b371888aaf8f51357c7457d836b86d12da91658b (at node_modules/@prisma/engines/libquery_engine-rhel-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli b371888aaf8f51357c7457d836b86d12da91658b (at node_modules/@prisma/engines/migration-engine-rhel-openssl-1.1.x)
Introspection Engine    : introspection-core b371888aaf8f51357c7457d836b86d12da91658b (at node_modules/@prisma/engines/introspection-engine-rhel-openssl-1.1.x)
Format Binary           : prisma-fmt b371888aaf8f51357c7457d836b86d12da91658b (at node_modules/@prisma/engines/prisma-fmt-rhel-openssl-1.1.x)
Default Engines Hash    : b371888aaf8f51357c7457d836b86d12da91658b
Studio                  : 0.458.0
Preview Features        : cockroachdb

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
SebJansencommented, Mar 21, 2022

Thank you for chasing this issue, and of course I’ll leave the cluster/connstring up! 😃

2reactions
janpiocommented, Mar 21, 2022

So we can confirm that the Data Platform is currently not compatible with the options=--cluster= parameter CockroachDB is using by default. We will try to change this soon and will update you here. (If you can leave the connection string up until that happens, that would be neat as we have been using that one to test and reproduce 😆)

That the alterantive connection string that @Jolg42 crafted does not work, is a bit more of a mystery. There we do not know exactly what is going on yet but will also investigate.

Thanks for reporting this @SebJansen - this will make Prisma better for everyone. Unfortunately you will have to wait a bit.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connect your database | node-cockroachdb - Prisma
Connecting your database. To connect your database, you need to set the url field of the datasource block in your Prisma schema to...
Read more >
Hellooo I cannot create a support ticket for the following i | Prisma ...
We were unable to create your project: Requested database check `reachable` failed. Is there a solution for this? I have tested the connection...
Read more >
Common Errors and Solutions | CockroachDB Docs
Understand and resolve common error messages written to stderr or logs. ... Client connection, node is running secure mode, SSL connection required.
Read more >
How we built a serverless SQL database - Hacker News
What happens when that database fails? Are you OK losing some data, or do you want the data to be synchronously replicated off...
Read more >
More than 600 built-in integrations - Datadog
Start collecting full-stack data in minutes with turnkey integrations for 600+ technologies from Datadog.
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