when we try to production keystone on docker it pops
✖ Connecting to database
Error: Multiple errors in BaseKeystoneAdapter.postConnect():
at resolveAllKeys (/home/node/node_modules/@keystonejs/utils/dist/utils.cjs.prod.js:44:95)
at async executeDefaultServer (/home/node/node_modules/@keystonejs/keystone/bin/utils.js:114:3) {
errors: {
MongooseAdapter: Error: Multiple errors in BaseKeystoneAdapter.postConnect():
at MongooseAdapter.connect (/home/node/node_modules/@keystonejs/keystone/lib/adapters/index.js:34:23)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async pReflect (/home/node/node_modules/p-reflect/index.js:5:17)
at async Promise.all (index 0)
at async resolveAllKeys (/home/node/node_modules/@keystonejs/utils/dist/utils.cjs.prod.js:42:21)
at async executeDefaultServer (/home/node/node_modules/@keystonejs/keystone/bin/utils.js:114:3) {
errors: [Array]
}
}
}
error Command failed with exit code 1.
docker build -t
Docker build run code below via Dockerfile
ARG NODE_VERSION=12.10.0
ARG DUMB_INIT_VERSION=1.2.2
FROM node:${NODE_VERSION}-alpine AS build
ARG DUMB_INIT_VERSION
WORKDIR /home/node
RUN apk add --no-cache build-base python2 yarn && \
wget -O dumb-init -q https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_amd64 && \
chmod +x dumb-init
ADD . /home/node
ENV CI false
ENV TZ America/New_York
RUN yarn install && yarn build && yarn cache clean
FROM node:${NODE_VERSION}-alpine
WORKDIR /home/node
COPY --from=build /home/node /home/node
EXPOSE 3000
CMD ["./dumb-init", "yarn", "start"]
Docker image build successful
docker run --env-file .env -p 3000:3000 should working
but got

If applicable, add screenshots to help explain your problem.
package.json
{
"name": "@keystonejs/demo-project-meetup",
"description": "An example KeystoneJS project showcasing a Meetup Site.",
"private": true,
"version": "5.0.0",
"author": "The KeystoneJS Development Team",
"license": "MIT",
"engines": {
"node": ">=8.4.0"
},
"scripts": {
"dev": "cross-env NODE_ENV=development DISABLE_LOGGING=true keystone dev ",
"build": "cross-env NODE_ENV=production keystone build",
"start": "cross-env NODE_ENV=production keystone start"
},
"dependencies": {
"@apollo/react-hoc": "^3.1.3",
"@apollo/react-hooks": "^3.1.3",
"@apollo/react-ssr": "^3.1.3",
"@babel/plugin-transform-flow-strip-types": "^7.10.4",
"@date-io/date-fns": "^2.4.0",
"@emotion/core": "^10.0.27",
"@keystonejs/adapter-mongoose": "^5.2.2",
"@keystonejs/app-admin-ui": "^5.9.2",
"@keystonejs/app-graphql": "^5.1.3",
"@keystonejs/app-next": "^5.1.1",
"@keystonejs/auth-password": "^5.1.2",
"@keystonejs/email": "^5.1.1",
"@keystonejs/fields": "^7.0.1",
"@keystonejs/fields-wysiwyg-tinymce": "^5.2.1",
"@keystonejs/file-adapters": "^6.0.0",
"@keystonejs/keystone": "^6.0.2",
"@keystonejs/session": "^5.1.1",
"@material-ui/core": "4.9.4",
"@material-ui/icons": "^4.9.1",
"@sendgrid/mail": "^7.1.1",
"apollo-boost": "^0.4.7",
"apollo-client": "^2.6.8",
"apollo-fetch": "^0.7.0",
"apollo-link": "^1.2.13",
"atob": "^2.0.3",
"axios": "^0.19.2",
"body-parser": "^1.18.2",
"btoa": "^1.1.2",
"client-oauth2": "^4.2.5",
"cookie-parser": "^1.4.5",
"cross-env": "^7.0.0",
"crypto-js": "^4.0.0",
"csrf": "^3.0.4",
"date-fns": "^1.30.1",
"dotenv": "^8.2.0",
"ejs": "^2.5.2",
"eslint-plugin-emotion": "^10.0.27",
"expect": "^1.20.2",
"express": "^4.17.1",
"express-basic-auth": "^1.2.0",
"express-session": "^1.14.2",
"facepaint": "^1.2.1",
"fs": "0.0.2",
"get-contrast": "^2.0.0",
"graphql-tag": "^2.10.1",
"https": "^1.0.0",
"intuit-oauth": "^2.0.2",
"isomorphic-unfetch": "^3.0.0",
"jquery": "^3.4.1",
"jsforce": "^1.9.3",
"jsonwebtoken": "^7.1.9",
"lodash": "^4.17.15",
"lodash.uniqby": "^4.7.0",
"material-table": "1.57.2",
"moment": "^2.24.0",
"namor": "^2.0.2",
"net": "^1.0.2",
"next": "^9.2.0",
"node-quickbooks": "^2.0.33",
"papaparse": "^5.2.0",
"path": "^0.12.7",
"prop-types": "^15.7.2",
"react": "^16.13.0",
"react-apollo": "2.4.0",
"react-apollo-hooks": "^0.4.4",
"react-cookie": "^4.0.3",
"react-dom": "^16.13.0",
"react-table": "^7.0.0-rc.16",
"react-toast-notifications": "^2.3.0",
"react-use-form-state": "^0.12.0",
"request": "^2.78.0",
"rsa-pem-from-mod-exp": "^0.8.4",
"tls": "^0.0.1",
"twilio": "^3.48.1",
"universal-cookie": "^4.0.3",
"uuid": "^3.3.2"
}
}
Add any other context about the problem here.
im getting this error even in development. I updated my package.json and now the adapter-mongoose won't connect when the collections already exist in the database. If I drop the database, the app connects without error.
my package.json
"dependencies": {
"@keystonejs/adapter-mongoose": "^9.0.1",
"@keystonejs/app-admin-ui": "^7.3.0",
"@keystonejs/app-graphql": "^6.1.0",
"@keystonejs/app-next": "^5.2.1",
"@keystonejs/auth-password": "^5.1.13",
"@keystonejs/fields": "^16.0.0",
"@keystonejs/file-adapters": "^7.0.2",
"@keystonejs/keystone": "^13.1.0",
"@keystonejs/list-plugins": "^7.0.5",
"@keystonejs/server-side-graphql-client": "^1.1.0",
"dotenv": "^8.2.0"
}
when i edit the file to console log the array of issues @HitsiLent mentioned in his bug report I get:
MongoError: a collection 'john.users' already exists
at MessageStream.messageHandler (<path-to-project>/node_modules/mongodb/lib/cmap/connection.js:266:20)
at MessageStream.emit (events.js:223:5)
at MessageStream.EventEmitter.emit (domain.js:475:20)
at processIncomingData (<path-to-project>/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
at MessageStream._write (<path-to-project>/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
at doWrite (_stream_writable.js:435:12)
at writeOrBuffer (_stream_writable.js:419:5)
at MessageStream.Writable.write (_stream_writable.js:309:11)
at Socket.ondata (_stream_readable.js:728:22)
at Socket.emit (events.js:223:5)
at Socket.EventEmitter.emit (domain.js:475:20)
at addChunk (_stream_readable.js:309:12)
at readableAddChunk (_stream_readable.js:290:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead (internal/stream_base_commons.js:181:23) {
ok: 0,
code: 48,
codeName: 'NamespaceExists',
name: 'MongoError'
}
im facing the same problem, how does one restart the service without hitting this error and still able to work on existing database, especially mongoose adapter?
@u007 Roll back to a version of your app that worked before the error started occurring.
I'm encountering the same error but haven't tracked down the cause yet. The best clue I've got is that the version of the mongodb package changed from 3.5.10 to 3.6.0. I'm rolling that back to see if it makes any difference.
Okay, I traced the issue down to the version of mongoose. Mongoose 5.10.0 was published yesterday, and broke @keysonejs/adapter-mongoose.
Here are the changes listed in the mongoose 5.10.0 changelog: https://github.com/Automattic/mongoose/blob/master/History.md#5100--2020-08-14
I don't know enough about keystone to guess which change caused the breakage. Either way, I'd recommend locking the adapter-mongoose dependency on mongoose to 5.9.11 in the meantime, until a long-term fix can be made.
TEMP FIX Before new release,
Dockerfiler add line after RUN yarn install
RUN rm -rf /home/node/node_modules/\@keystonejs/adapter-mongoose/node_modules/mongoose
RUN rm -rf node_modules/\@keystonejs/adapter-mongoose/node_modules/mongoose
add "mongoose": "5.9.11" on package.json file
Hey folks. Any update here? I just have the same issue on my local.
Thanks to all who have reported this bug. We're investigating it this morning and will ship a fix today.
Most helpful comment
TEMP FIX Before new release,
Dockerfiler add line after RUN yarn install
RUN rm -rf /home/node/node_modules/\@keystonejs/adapter-mongoose/node_modules/mongoose
RUN rm -rf node_modules/\@keystonejs/adapter-mongoose/node_modules/mongoose
add "mongoose": "5.9.11" on package.json file