AWS Lambda 层/节点:Postgres 客户端失败,并显示“证书链中的自签名证书”

AWS Lambda Layer/Node: Postgres client fails with "self-signed certificate in certificate chain"

提问人:James A Cubeta 提问时间:11/18/2023 更新时间:11/18/2023 访问量:15

问:

我正在使用 Postgres RDS 在 AWS Lambda 中工作,并且我正在尝试将我的数据库管理代码移动到可在函数之间共享的 Lambda 层中。代码在函数中运行良好,但是当我将其移动到该层时,它会因错误而死亡:

Unhandled Promise Rejection     
{
   "errorType":"Runtime.UnhandledPromiseRejection",
   "errorMessage":"Error: self-signed certificate in certificate chain",
   ...
}

我的Postgres客户端代码的要点如下:

const pg = require('pg')
# db_info is pulled from Secrets Manager
let client = new pg.Client({
            host: db_info.host,
            user: db_info.username,
            database: db_info.dbName,
            password: db_info.password,
            port: db_info.port,
            ssl: true
        });
        client.connect();

我是 AWS Lambda 的新手,所以我有点盲目。任何建议将不胜感激。

节点.js PostgreSQL AWS-Lambda-Layers

评论


答: 暂无答案