Hi,
In my Firebase Functions, I need to connect to a MongoDB Atlas Database with mongoose. I saw that the Spark Plan "allows outbound network requests only to Google-owned services".
So I went for the Blake Plan, but I still got an error in the functions logs :
connection error: { MongoError: authentication fail at Function.MongoError.create (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/error.js:31:11) at /user_code/node_modules/mongoose/node_modules/mongodb-core/lib/topologies/replset.js:1170:38 at /user_code/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:730:7 at /user_code/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:706:20 at finish (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/auth/scram.js:163:16) at handleEnd (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/auth/scram.js:173:7) at Object.cb (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/auth/scram.js:273:11) at Connection.<anonymous> (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:243:32) at Connection.g (events.js:291:16) at emitTwo (events.js:106:13) at Connection.emit (events.js:191:7) at TLSSocket.<anonymous> (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:185:10) at TLSSocket.g (events.js:291:16) at emitNone (events.js:86:13) at TLSSocket.emit (events.js:185:7) at TLSSocket.Socket._onTimeout (net.js:339:8) name: 'MongoError', message: 'authentication fail', errors: [ { name: ' clustersomwer-shard-00-02-znghe.mongodb.net:27017', err: [Object] } ] } | |
connection error: { MongoError: authentication fail
at Function.MongoError.create (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/error.js:31:11)
at /user_code/node_modules/mongoose/node_modules/mongodb-core/lib/topologies/replset.js:1170:38
at /user_code/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:730:7
at /user_code/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:706:20
at finish (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/auth/scram.js:163:16)
at handleEnd (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/auth/scram.js:173:7)
at Object.cb (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/auth/scram.js:273:11)
at Connection.<anonymous> (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:243:32)
at Connection.g (events.js:291:16)
at emitTwo (events.js:106:13)
at Connection.emit (events.js:191:7)
at TLSSocket.<anonymous> (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:185:10)
at TLSSocket.g (events.js:291:16)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket.Socket._onTimeout (net.js:339:8)
name: 'MongoError',
message: 'authentication fail',
errors:
[ { name: 'XXXXX.mongodb.net:27017',
err: [Object] } ] }
I didn't find any solution to my problem.
By the way, the connection worked on my own NodeJS server, so I can't figure out why it is not working here, maybe it is allowed to requests only Google Services for all Plan ?
Thanks !