avatar
MongodDB errors
by Sam Howell - Monday, 24 August 2020, 7:23 AM
 

When attempting to upgrade to the latest version of the AAT (v0.10.4), I run into some errors I've not seen before. The upgrade appears to succeed, but then MongoDB appears to break. While the errors are clearly stated in the output provided, I don't know how to fix them.

On inspecting the mongod service, I can see that it's failed, and no amount of stopping and restarting it works.

I can provide further error logs if needed, but I was hoping the below output would be enough to offer some clues to anyone who knows their way around the AAT, Node.js, MongoDB etc.

Framework: v5.6.1
Authoring tool: v0.10.3

sam@adapt:~/adapt/adapt_authoring$ sudo node server
info [24 Aug 20 07:38:47 +01:00] configuration loaded from /home/sam/adapt/adapt_authoring/conf/config.json
info [24 Aug 20 07:38:47 +01:00] Supporting the following authentication types:
info [24 Aug 20 07:38:47 +01:00] - local
info [24 Aug 20 07:38:47 +01:00] Connection established: adapt-tenant-master
info [24 Aug 20 07:38:49 +01:00] Adapt authoring tool v0.10.3 (v0.10.4 is now available).
info [24 Aug 20 07:38:49 +01:00] Adapt framework 5.6.1.
info [24 Aug 20 07:38:49 +01:00] Run node upgrade.js to update your install.
info [24 Aug 20 07:38:49 +01:00] Server started listening on port 5000
^C
sam@adapt:~/adapt/adapt_authoring$ sudo node upgrade

This script will update the Adapt authoring tool and/or Adapt Framework. Would you like to continue?
> Continue? Y/n (Y)
> Update automatically? Y/n (Y)

Software updates found.

/home/sam/adapt/adapt_authoring switched to revision v0.10.4
Node dependencies installed successfully.
Web application built successfully.
Server has been updated successfully!
Adapt authoring tool upgraded to v0.10.4
(node:1165) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
MongoDB Connection Error: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
  name: 'MongoNetworkError',
  [Symbol(mongoErrorContextSymbol)]: {}
}]
(node:1165) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
  name: 'MongoNetworkError',
  [Symbol(mongoErrorContextSymbol)]: {}
}]
    at Pool.<anonymous> (/home/sam/adapt/adapt_authoring/node_modules/mongoose/node_modules/mongodb/lib/core/topologies/server.js:433:11)
    at Pool.emit (events.js:315:20)
    at Pool.EventEmitter.emit (domain.js:483:12)
    at /home/sam/adapt/adapt_authoring/node_modules/mongoose/node_modules/mongodb/lib/core/connection/pool.js:577:14
    at /home/sam/adapt/adapt_authoring/node_modules/mongoose/node_modules/mongodb/lib/core/connection/pool.js:1007:11
    at /home/sam/adapt/adapt_authoring/node_modules/mongoose/node_modules/mongodb/lib/core/connection/connect.js:31:7
    at callback (/home/sam/adapt/adapt_authoring/node_modules/mongoose/node_modules/mongodb/lib/core/connection/connect.js:247:5)
    at Socket.<anonymous> (/home/sam/adapt/adapt_authoring/node_modules/mongoose/node_modules/mongodb/lib/core/connection/connect.js:276:7)
    at Object.onceWrapper (events.js:422:26)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:483:12)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:1165) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1165) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^C
sam@adapt:~/adapt/adapt_authoring$

Picture of Ailiniyazi Maimaiti
Re: MongodDB errors
by Ailiniyazi Maimaiti - Monday, 24 August 2020, 7:27 AM
 

Hi Sam,

it looks like your app failed to connect with MongoDB, maybe MongoDB wasn't running,