Report this

What is the reason for this report?

App Platform service connecting to Manage MySQL receives 'self signed certificate in certificate chain' error

Posted on June 12, 2024

I have two projects, one containing a database and the other containing an app via the App Platform.

I’m trying to connect to my database via my deployed app but I receive a self signed certificate in certificate chain error on connection attempts. The credentials themselves work via a GUI and the app itself is marked as a trusted source. This has been done via manually inputting the CA Cert as an env variable.

I’ve also tried creating a component specific env variable from this guide in the App Platform’s config but it can’t find my database service.

My connection code looks like the below. I’m aware I can set rejectUnauthorized: false against my connection, but I don’t want to have to do this. How can I get my App Platform component to successfully connect to my Database?

const mysql = require("mysql2/promise");
let pool;
...
pool = mysql.createPool({
    host: MYSQL_HOST,
    user: MYSQL_USERNAME,
    password: MYSQL_PASSWORD,
    database: MYSQL_DATABASE,
    port: MYSQL_PORT,
    waitForConnections: true,
    connectionLimit: 10,
    maxIdle: 10,
    idleTimeout: 60000,
    queueLimit: 0,
    enableKeepAlive: true,
    keepAliveInitialDelay: 0,
    supportBigNumbers: true,
    timezone: "Z",
    ssl: {
        ca: process.env.MYSQL_CA_CERT,
    },
});

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.