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 #1041

Closed
21020620 opened this issue Jul 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@21020620
Copy link

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
@dosubot dosubot bot added the bug Something isn't working label Jul 15, 2024
@jsumners
Copy link
Member

Stop creating the same issue in multiple repos/channels.

@fastify fastify locked and limited conversation to collaborators Jul 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants