部署到Modulus.io后,我收到“内部服务器错误”
日志:
/mnt/data/2/node_modules/mongodb/lib/mongodb/mongo_client.js:423
throw err
^
MongoError: auth fails
at Object.toError (/mnt/data/2/node_modules/mongodb/lib/mongodb/utils.js:110:11)
at /mnt/data/2/node_modules/mongodb/lib/mongodb/auth/mongodb_cr.js:39:33
at /mnt/data/2/node_modules/mongodb/lib/mongodb/db.js:1806:9
at Server.Base._callHandler (/mnt/data/2/node_modules/mongodb/lib/mongodb/connection/base.js:442:41)
at /mnt/data/2/node_modules/mongodb/lib/mongodb/connection/server.js:485:18
at MongoReply.parseBody (/mnt/data/2/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
at null.<anonymous> (/mnt/data/2/node_modules/mongodb/lib/mongodb/connection/server.js:443:20)
at EventEmitter.emit (events.js:95:17)
at null.<anonymous> (/mnt/data/2/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:191:13)
at EventEmitter.emit (events.js:98:17)
[2013-12-29T18:29:34.978Z] Application CRASH detected. Exit code 8.
[2013-12-29T18:29:36.286Z] Application restarted.
答案 0 :(得分:1)
您是否设置了mongodb MONGO_URL
?错误auth fails
表示您使用的身份验证详细信息可能不正确。
确保使用正确的用户名和密码在环境变量中使用MONGO_URL=mongodb://<user>:<pass>@<ip_address>:<port>/<database name>
之类的内容。您可以先在本地测试以查看数据库的工作情况。