【发布时间】:2019-03-25 18:15:37
【问题描述】:
从 firebase 函数连接到 mongodb atlas 时,我随机出现以下错误。知道是什么原因造成的(似乎无需任何干预即可自动修复)?
{
MongoError: command aggregate requires authentication
at queryCallback (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/cursor.js:248:25)
at /user_code/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:532:18
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
operationTime: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1540073032 },
ok: 0,
errmsg: 'command aggregate requires authentication',
code: 13,
codeName: 'Unauthorized',
'$clusterTime':
{ clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1540073032 },
signature: { hash: [Object], keyId: [Object] } },
name: 'MongoError'
}
【问题讨论】:
-
我假设您已经检查了错误所暗示的身份验证?
-
这是随机发生的。如果我重新部署 firebase 功能,它大部分时间都会得到修复。发生的情况是应用程序在一段时间内正常工作,然后突然这些错误开始出现,这有效地停止了依赖数据库的每个操作。
标签: mongodb mongoose google-cloud-functions mongodb-atlas