AWS Lambda Postgres数据库连接在时间间隔上的问题

时间:2019-03-14 07:43:16

标签: node.js postgresql amazon-web-services aws-lambda

Please see below the error that I am getting while executing a lambda after 
a particular time interval. Any suggestions will be appreciated.
  

“ pid”:1,       “级别”:50,       “呃”: {           “ message”:“连接意外终止”,           “ name”:“ SequelizeConnectionError”,           “ stack”:“ SequelizeConnectionError:连接意外终止\ n
      在connection.connect.err       (/ var / task / node_modules / sequelize / lib / dialects / postgres / connection-       manager.js:132:20)\ n在Connection.con.once       (/var/task/node_modules/pg/lib/client.js:211:11)\n在Object.onceWrapper       (events.js:313:30)\ n在发射无(events.js:106:13)\ n在       套接字上的Connection.emit(events.js:208:7)\ n。
      (/var/task/node_modules/pg/lib/connection.js:130:10)\n在发射无       (events.js:111:20)\ n在Socket.emit(events.js:208:7)\ n在       在_combinedTickCallback处endReadableNT(_stream_visible.js:1064:12)\ n       (internal / process / next_tick.js:138:11)\ n在process._tickDomainCallback       (内部/进程/next_tick.js:218:9)”       },       “ msg”:“连接意外终止”

The DB connection code is as below

const sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, 
process.env.DB_PWD, {
host: process.env.DB_HOST,
dialect: 'postgres',
logging: process.env.DB_SHOW_LOGS === 'true',
port: process.env.DB_PORT,
pool: {
 max: 5,
 min: 1,
 acquire: 30000,
idle: 10000
},
operatorsAliases: false
});

0 个答案:

没有答案