问题描述:
我使用sequalize orm和firebase cloud函数,每当我查询mysql db时,都会出现sequelizeconnectioneror:connect etimedout错误。当函数通过firebase cli在localhost上运行时,它可以正常工作。下面是sequalize连接方法。
代码段
var sequelize = new Sequelize('dbname, 'username', 'password', {
host: "host",
dialect: 'mysql',
define: {
paranoid: true
},
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 1
},
operatorsAliases: false})
当函数在端口5000上通过firebase cli本地运行时,上面的代码工作得非常好。当我在firebase上部署它并运行相同的函数时,我得到以下错误。
2018-06-23T11:31:53.887Z E app: Unhandled rejection
2018-06-23T11:31:55.187Z E app: SequelizeConnectionError: connect ETIMEDOUT
at Utils.Promise.tap.then.catch.err (/user_code/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:149:19)
at tryCatcher (/user_code/node_modules/sequelize/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/user_code/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/user_code/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/user_code/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/user_code/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (/user_code/node_modules/sequelize/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/user_code/node_modules/sequelize/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/user_code/node_modules/sequelize/node_modules/bluebird/js/release/async.js:17:14
)
2条答案
按热度按时间3duebb1j1#
您可能只允许一个最大大小为1的池。
l5tcr1uw2#
这很可能是因为你的firebase项目是免费的spark支付计划。有了spark,你的云功能就不能连接到那些不完全由google控制的服务。要建立传出连接,您必须将项目升级到其中一个付款计划,例如blaze。
请阅读firebase定价页上的更多信息。