Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unable to get local issuer certificate when using AWS RDS Proxy with @fastify/mysql #142

Open
2 tasks done
21020620 opened this issue Jul 15, 2024 · 0 comments
Open
2 tasks done

Comments

@21020620
Copy link

21020620 commented Jul 15, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

What are you trying to achieve, or the steps to reproduce?

I am trying to connect to an RDS Proxy endpoint (Proxy is connected to an RDS MySQL instance) with my node server running on Amazon Linux 2023 EC2 instance. The node server is using the Fastify framework, and to connect to the Proxy, I am using the @fastify/mysql plugin.
Link here: https://github.com/fastify/fastify-mysql.
The problem occurs if I enable "Require TLS" for the Proxy (if not, it is working fine).
So this is the code for the connection:

import fastifyMysql from "@fastify/mysql";
import { readFileSync } from "fs";

fastify.register(fastifyMysql, {
    host: process.env.MYSQL_HOST,
    user: process.env.MYSQL_USER,
    password: process.env.MYSQL_PASSWORD,
    database: process.env.MYSQL_DATABASE,
    promise: true,
    ssl: {
      ca: readFileSync('./ap-southeast-1-bundle.pem')
    }
});

What was the result you received?

When I try to run the server, it returns the error: Error: unable to get local issuer certificate

The .pem file was downloaded to the same directory with the code using: curl -o ap-southeast-1-bundle.pem https://truststore.pki.rds.amazonaws.com/ap-southeast-1/ap-southeast-1-bundle.pem

I would really appreciate if anyone can help!

Context

  • fastify version: latest
  • os: Amazon Linux 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant