Node.js 使用Sequelize通过SSL连接到CloudSQL

Node.js 使用Sequelize通过SSL连接到CloudSQL,node.js,sequelize.js,google-cloud-sql,Node.js,Sequelize.js,Google Cloud Sql,我需要将Lambda上的NodeJS应用程序连接到Google Cloud SQL中的PSQL数据库 node js应用程序使用Sequelize,我很难找到关于如何在Sequelize上显示SSL信息的指导 这是云SQL希望我指定的: psql "sslmode=verify-ca sslrootcert=server-ca.pem \ sslcert=client-cert.pem sslkey=client-key.pem \ hostaddr=[HOST ID

我需要将Lambda上的NodeJS应用程序连接到Google Cloud SQL中的PSQL数据库

node js应用程序使用Sequelize,我很难找到关于如何在Sequelize上显示SSL信息的指导

这是云SQL希望我指定的:

  psql "sslmode=verify-ca sslrootcert=server-ca.pem \
      sslcert=client-cert.pem sslkey=client-key.pem \
      hostaddr=[HOST ID] \
      port=5432 \
      user=postgres dbname=postgres"
这就是我目前在node js应用程序上一直超时的内容:

const sequelize = new Sequelize(
  'postgres',
  'postgres',
  'password',
  {
    host: '[HOST ID]',
    dialect: 'postgres',
    dialectOptions: {
      ssl: {
        key: cKey,
        cert: cCert,
        ca: cCA,
      }
    }
  },
);
这是我收到的错误消息:

Unhandled rejection SequelizeConnectionError: connect ETIMEDOUT 35.232.250.60:5432
    at connection.connect.err (/Users/stephanielee/Desktop/blag/dist/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:154:24)
    at Connection.connectingErrorHandler (/Users/stephanielee/Desktop/blag/dist/node_modules/pg/lib/client.js:174:14)
    at Connection.emit (events.js:182:13)
    at Connection.EventEmitter.emit (domain.js:442:20)
    at Socket.reportStreamError (/Users/stephanielee/Desktop/blag/dist/node_modules/pg/lib/connection.js:72:10)
    at Socket.emit (events.js:182:13)
    at Socket.EventEmitter.emit (domain.js:442:20)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

这是使用公共IP吗?我有类似的问题。我认为您必须设置公共IP并将您的IP地址添加到白名单中。这在一定程度上对我有效,因为我获得了连接,但我仍然难以使用公共IP进行认证?我也有类似的问题。我认为您必须设置公共IP并将您的IP地址添加到白名单中。这在一定程度上对我有效,因为我获得了连接,但我仍然难以获得证书