【发布时间】:2021-09-07 06:48:37
【问题描述】:
由于堆栈更改,Heroku 删除了几个月前与 MongoDB Atlas 完美连接的 KeystoneJS V4 应用程序。现在我正在尝试使用正确的配置部署相同的应用程序,但出现部署错误。这是我得到的错误:
2021-06-23T17:14:40.418968+00:00 heroku[web.1]: State changed from crashed to starting
2021-06-23T17:14:43.000000+00:00 app[api]: Build succeeded
2021-06-23T17:14:46.464645+00:00 heroku[web.1]: Starting process with command `node keystone.js`
2021-06-23T17:14:49.588440+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2021-06-23T17:14:49.588949+00:00 app[web.1]: designed for a production environment, as it will leak
2021-06-23T17:14:49.588950+00:00 app[web.1]: memory, and will not scale past a single process.
2021-06-23T17:14:49.711527+00:00 app[web.1]: ------------------------------------------------
2021-06-23T17:14:49.711682+00:00 app[web.1]: Mongoose connection "error" event fired with:
2021-06-23T17:14:49.712891+00:00 app[web.1]: Error [MongoError]: failed to connect to server [cluster-1z703hln.tt6wq.mongodb.net:27017] on first connect
2021-06-23T17:14:49.712894+00:00 app[web.1]: at Pool.<anonymous> (/app/node_modules/mongodb-core/lib/topologies/server.js:326:35)
2021-06-23T17:14:49.712894+00:00 app[web.1]: at Pool.emit (events.js:314:20)
2021-06-23T17:14:49.712894+00:00 app[web.1]: at Connection.<anonymous> (/app/node_modules/mongodb-core/lib/connection/pool.js:272:12)
2021-06-23T17:14:49.712895+00:00 app[web.1]: at Object.onceWrapper (events.js:421:26)
2021-06-23T17:14:49.712895+00:00 app[web.1]: at Connection.emit (events.js:314:20)
2021-06-23T17:14:49.712896+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:175:49)
2021-06-23T17:14:49.712896+00:00 app[web.1]: at Object.onceWrapper (events.js:421:26)
2021-06-23T17:14:49.712897+00:00 app[web.1]: at Socket.emit (events.js:314:20)
2021-06-23T17:14:49.712897+00:00 app[web.1]: at emitErrorNT (internal/streams/destroy.js:92:8)
2021-06-23T17:14:49.712897+00:00 app[web.1]: at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
2021-06-23T17:14:49.712899+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:84:21)
2021-06-23T17:14:49.713715+00:00 app[web.1]: Error: KeystoneJS (My-App) failed to start - Check that you are running `mongod` in a separate process.
2021-06-23T17:14:49.713716+00:00 app[web.1]: at NativeConnection.<anonymous> (/app/node_modules/keystone/lib/core/openDatabaseConnection.js:59:10)
2021-06-23T17:14:49.713716+00:00 app[web.1]: at NativeConnection.emit (events.js:314:20)
2021-06-23T17:14:49.713717+00:00 app[web.1]: at Immediate.<anonymous> (/app/node_modules/mongoose/lib/connection.js:296:19)
2021-06-23T17:14:49.713717+00:00 app[web.1]: at processImmediate (internal/timers.js:461:21)
2021-06-23T17:14:49.801512+00:00 heroku[web.1]: Process exited with status 1
2021-06-23T17:14:49.940361+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-23T17:14:49.950336+00:00 heroku[web.1]: State changed from crashed to starting
2021-06-23T17:14:57.803099+00:00 heroku[web.1]: Starting process with command `node keystone.js`
2021-06-23T17:15:02.052669+00:00 heroku[web.1]: Process exited with status 1
2021-06-23T17:15:02.247835+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-23T17:15:01.788675+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2021-06-23T17:15:01.788702+00:00 app[web.1]: designed for a production environment, as it will leak
2021-06-23T17:15:01.788703+00:00 app[web.1]: memory, and will not scale past a single process.
2021-06-23T17:15:01.971420+00:00 app[web.1]: ------------------------------------------------
2021-06-23T17:15:01.971542+00:00 app[web.1]: Mongoose connection "error" event fired with:
2021-06-23T17:15:01.975012+00:00 app[web.1]: Error [MongoError]: failed to connect to server [cluster-1z703hln.tt6wq.mongodb.net:27017] on first connect
2021-06-23T17:15:01.975013+00:00 app[web.1]: at Pool.<anonymous> (/app/node_modules/mongodb-core/lib/topologies/server.js:326:35)
2021-06-23T17:15:01.975014+00:00 app[web.1]: at Pool.emit (events.js:314:20)
2021-06-23T17:15:01.975014+00:00 app[web.1]: at Connection.<anonymous> (/app/node_modules/mongodb-core/lib/connection/pool.js:272:12)
2021-06-23T17:15:01.975014+00:00 app[web.1]: at Object.onceWrapper (events.js:421:26)
2021-06-23T17:15:01.975015+00:00 app[web.1]: at Connection.emit (events.js:314:20)
2021-06-23T17:15:01.975015+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:175:49)
2021-06-23T17:15:01.975016+00:00 app[web.1]: at Object.onceWrapper (events.js:421:26)
2021-06-23T17:15:01.975016+00:00 app[web.1]: at Socket.emit (events.js:314:20)
2021-06-23T17:15:01.975016+00:00 app[web.1]: at emitErrorNT (internal/streams/destroy.js:92:8)
2021-06-23T17:15:01.975017+00:00 app[web.1]: at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
2021-06-23T17:15:01.975017+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:84:21)
2021-06-23T17:15:01.975867+00:00 app[web.1]: Error: KeystoneJS (My-APP) failed to start - Check that you are running `mongod` in a separate process.
2021-06-23T17:15:01.975868+00:00 app[web.1]: at NativeConnection.<anonymous> (/app/node_modules/keystone/lib/core/openDatabaseConnection.js:59:10)
2021-06-23T17:15:01.975868+00:00 app[web.1]: at NativeConnection.emit (events.js:314:20)
2021-06-23T17:15:01.975868+00:00 app[web.1]: at Immediate.<anonymous> (/app/node_modules/mongoose/lib/connection.js:296:19)
2021-06-23T17:15:01.975869+00:00 app[web.1]: at processImmediate (internal/timers.js:461:21)
请有人帮我解决这个问题。不知道为什么我会收到这个错误。我有正确的 MONGODB_URI(在另一个应用上可以正常工作)。
【问题讨论】:
标签: node.js mongodb heroku mongoose keystonejs