Hi GB team. we are facing this error when try to u...
# give-feedback
h
Hi GB team. we are facing this error when try to upgrade GB from 1.9.0 to 2.2.0 for self-hosted version. we are using DocumentDB Engine 4.0.0 on AWS for MongoDB. Any change needed for the upgrade?
Copy code
(node:58) [MONGOOSE] DeprecationWarning: Mongoose: the `strictQuery` option will be switched back to `false` by default in Mongoose 7. Use `mongoose.set('strictQuery', false);` if you want to prepare for this change. Or use `mongoose.set('strictQuery', true);` to suppress this warning.
(Use `node --trace-deprecation ...` to show where the warning was created)
{"level":30,"time":1687832395834,"pid":58,"hostname":"growthbook-6d989776b6-kbpqm","msg":"Back-end is running at <http://localhost:3100> in production mode. Press CTRL-C to stop"}
{"level":40,"time":1687832395836,"pid":58,"hostname":"growthbook-6d989776b6-kbpqm","err":{"type":"MongooseError","message":"MongoDB prohibits index creation on connections that read from non-primary replicas.  Connections that set \"readPreference\" to \"secondary\" or \"secondaryPreferred\" may not opt-in to the following connection options: autoCreate, autoIndex","stack":"MongooseError: MongoDB prohibits index creation on connections that read from non-primary replicas.  Connections that set \"readPreference\" to \"secondary\" or \"secondaryPreferred\" may not opt-in to the following connection options: autoCreate, autoIndex\n    at throwReadPreferenceError (/usr/local/src/app/node_modules/mongoose/lib/helpers/processConnectionOptions.js:56:9)\n    at resolveOptsConflicts (/usr/local/src/app/node_modules/mongoose/lib/helpers/processConnectionOptions.js:22:5)\n    at processConnectionOptions (/usr/local/src/app/node_modules/mongoose/lib/helpers/processConnectionOptions.js:13:7)\n    at NativeConnection.Connection.openUri (/usr/local/src/app/node_modules/mongoose/lib/connection.js:741:13)\n    at /usr/local/src/app/node_modules/mongoose/lib/index.js:414:10\n    at /usr/local/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5\n    at Promise._execute (/usr/local/src/app/node_modules/bluebird/js/release/debuggability.js:384:9)\n    at Promise._resolveFromExecutor (/usr/local/src/app/node_modules/bluebird/js/release/promise.js:518:18)\n    at new Promise (/usr/local/src/app/node_modules/bluebird/js/release/promise.js:103:10)\n    at promiseOrCallback (/usr/local/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)\n    at Mongoose._promiseOrCallback (/usr/local/src/app/node_modules/mongoose/lib/index.js:1288:10)\n    at Mongoose.connect (/usr/local/src/app/node_modules/mongoose/lib/index.js:413:20)\n    at /usr/local/src/app/packages/back-end/dist/init/mongo.js:34:34\n    at Generator.next (<anonymous>)\n    at /usr/local/src/app/packages/back-end/dist/init/mongo.js:8:71\n    at new Promise (<anonymous>)"},"msg":"Failed to connect to MongoDB. Retrying with field remapping for mongodb v3 to v4"}
{"level":50,"time":1687832395837,"pid":58,"hostname":"growthbook-6d989776b6-kbpqm","err":{"type":"TypeError","message":"Cannot read properties of undefined (reading 'then')","stack":"TypeError: Cannot read properties of undefined (reading 'then')\n    at NativeConnection.Connection.openUri (/usr/local/src/app/node_modules/mongoose/lib/connection.js:726:57)\n    at /usr/local/src/app/node_modules/mongoose/lib/index.js:414:10\n    at /usr/local/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5\n    at Promise._execute (/usr/local/src/app/node_modules/bluebird/js/release/debuggability.js:384:9)\n    at Promise._resolveFromExecutor (/usr/local/src/app/node_modules/bluebird/js/release/promise.js:518:18)\n    at new Promise (/usr/local/src/app/node_modules/bluebird/js/release/promise.js:103:10)\n    at promiseOrCallback (/usr/local/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)\n    at Mongoose._promiseOrCallback (/usr/local/src/app/node_modules/mongoose/lib/index.js:1288:10)\n    at Mongoose.connect (/usr/local/src/app/node_modules/mongoose/lib/index.js:413:20)\n    at /usr/local/src/app/packages/back-end/dist/init/mongo.js:50:38\n    at Generator.throw (<anonymous>)\n    at rejected (/usr/local/src/app/packages/back-end/dist/init/mongo.js:6:65)"},"msg":"Failed to connect to MongoDB after retrying"}
{"level":50,"time":1687832395838,"pid":58,"hostname":"growthbook-6d989776b6-kbpqm","err":{"type":"Error","message":"MongoDB connection error.","stack":"Error: MongoDB connection error.\n    at /usr/local/src/app/packages/back-end/dist/init/mongo.js:54:19\n    at Generator.throw (<anonymous>)\n    at rejected (/usr/local/src/app/packages/back-end/dist/init/mongo.js:6:65)"},"msg":"Failed to initialize application"}
error Command failed with exit code 1.
info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
`yarn start` failed with exit code 1
nvm. figured it out by just removing
readPreference
in the DB connection string
f
okay, cool
we did upgrade the mongo library
1
175 Views