Skip to content

[MySQL] Throw a better error message when connection is rejected due to self signed ssl certificate #4605

@pantharshit00

Description

@pantharshit00

Bug description

Right now when you try to use a self signed certificate with MySQL connector without the sslaccept=accept_invalid_certs option, the mysql connector throws a very vague error message.

"Error: Error: P1001: Can't reach database server at `34.89.255.60`:`3306`

Now with this error message, it is very hard to debug what is wrong with the connection details.

How to reproduce

  1. Make a Google Cloud SQL MySQL instance as to demonstrate a service which uses self signed ssl certificates.
  2. Disallow non ssl connections from the connections tab. Allow 0.0.0.0/0 to connect(basically anyone)
  3. Download the connection details and certificates and try connecting to the instance without the sslaccept=accept_invalid_certs option.

Expected behavior

A better error message like certificate was not trusted should be thrown.

Environment & setup

  • OS: Arch Linux Kernel version 5.9.13-arch1-1
  • Database: MySQL 5.7 or 8
  • Node.js version: v14.15.0
  • Prisma version:
@prisma/cli          : 2.13.0
@prisma/client       : 2.13.0
Current platform     : debian-openssl-1.1.x
Query Engine         : query-engine 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine     : migration-engine-cli 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary        : prisma-fmt 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Studio               : 0.329.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions