NodeBB fails to start after upgrade to Mongo 4.4

Created on 2 Nov 2020  路  8Comments  路  Source: NodeBB/NodeBB

After upgrade to Mongo 4.4 NodeBB fails to start with the following error:

(node:269) DeprecationWarning: Db.createCollection option [strict] is deprecated and will be removed in a later version.
MongoError: Collection already exists. NS: nodebb.pubsub
    at MessageStream.messageHandler (/usr/src/app/node_modules/@nodebb/mubsub/node_modules/mongodb/lib/cmap/connection.js:268:20)
    at MessageStream.emit (events.js:315:20)
    at processIncomingData (/usr/src/app/node_modules/@nodebb/mubsub/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
    at MessageStream._write (/usr/src/app/node_modules/@nodebb/mubsub/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
    at doWrite (_stream_writable.js:403:12)
    at writeOrBuffer (_stream_writable.js:387:5)
    at MessageStream.Writable.write (_stream_writable.js:318:11)
    at Socket.ondata (_stream_readable.js:716:22)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12) {

I have tested it locally and I have found out, that:

  • With Mongo 4.4[*] it fails, but only when there is an array of ports in config.json (e. g. "port": ["4567", "4568"]). It starts without errors when there is a single port (e. g. "port": "4567").
  • With Mongo 4.4[*] it works correctly if I downgrade mongodb to version 3.3.3 in node_modules/@nodebb/mubsub (even with multiple NodeBB instances = with an array of ports in the config).
  • With Mongo 4.2[*] it works correctly (even with multiple NodeBB instances = with an array of ports in the config).

[*] I have used Docker Mongo images mongo:4.4 and mongo:4.2 for testing.

Environment details

  • NodeBB version: 1.14.3
  • NodeBB git hash: N/A (we are using tarball from https://github.com/NodeBB/NodeBB/releases/tag/v1.14.3)
  • Database type: mongo
  • Database version: 4.4

Related links

bug

All 8 comments

"@nodebb/mubsub": "1.7.0",
"@nodebb/socket.io-adapter-mongo": "3.1.0",

I have checked our installation and we have @nodebb/mubsub 1.7.0 and @nodebb/socket.io-adapter-mongo 3.0.1. I think it uses this package.json file.

We plan on releasing 1.15.0 this week you can either wait for that or manually update the socket.io-adapter-mongo dependency.

We will wait for 1.15.0, thanks! 馃檪

1.15.0 is released let us know after updating.

It seems that there is the same problem on 1.15.0:

nodebb_1  | 2020-11-05T12:17:08.829Z [4567/183] - info: Initializing NodeBB v1.15.0 http://localhost:4567
nodebb_1  | (node:183) DeprecationWarning: The option `autoReconnect` is incompatible with the unified topology, please read more by visiting http://bit.ly/2D8WfT6
nodebb_1  | (node:183) DeprecationWarning: Db.createCollection option [strict] is deprecated and will be removed in a later version.
nodebb_1  | (node:189) DeprecationWarning: The option `autoReconnect` is incompatible with the unified topology, please read more by visiting http://bit.ly/2D8WfT6
nodebb_1  | (node:189) DeprecationWarning: Db.createCollection option [strict] is deprecated and will be removed in a later version.
nodebb_1  | MongoError: Collection already exists. NS: nodebb.pubsub
nodebb_1  |     at MessageStream.messageHandler (/usr/src/app/node_modules/mongodb/lib/cmap/connection.js:268:20)
nodebb_1  |     at MessageStream.emit (events.js:315:20)
nodebb_1  |     at processIncomingData (/usr/src/app/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
nodebb_1  |     at MessageStream._write (/usr/src/app/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
nodebb_1  |     at doWrite (_stream_writable.js:403:12)
nodebb_1  |     at writeOrBuffer (_stream_writable.js:387:5)
nodebb_1  |     at MessageStream.Writable.write (_stream_writable.js:318:11)
nodebb_1  |     at Socket.ondata (_stream_readable.js:716:22)
nodebb_1  |     at Socket.emit (events.js:315:20)
nodebb_1  |     at addChunk (_stream_readable.js:295:12) {
nodebb_1  |   ok: 0,
nodebb_1  |   code: 48,
nodebb_1  |   codeName: 'NamespaceExists'
nodebb_1  | }

Did you check the install versions of these dependencies?

"@nodebb/mubsub": "1.7.0",
"@nodebb/socket.io-adapter-mongo": "3.1.0",

npm ls @nodebb/mubsub 
npm ls @nodebb/socket.io-adapater-mongo
Was this page helpful?
0 / 5 - 0 ratings