Error: Unable to get local issuer certificate when using AWS RDS Proxy with @fastify/mysql
### Prerequisites
- [X] I have written a descriptive issue title
- [X] 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:
```js
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
0 条评论