learninglocker icon indicating copy to clipboard operation
learninglocker copied to clipboard

Exports not created after update from 2.3.3 to 5.3.0

Open figureone opened this issue 6 years ago • 1 comments

What version were you using?

Version 5.3.0 (open source)

What steps can we follow to reproduce the behaviour?

We upgraded a Learning Locker server from version 2.3.3 to 5.3.0 by creating a new VM, installing the latest version of Learning Locker using the deployll.sh install script, exporting/importing the database using mongodump and mongorestore, and then running all pending migrations via node cli/dist/server migrateMongo. Old server was Ubuntu 16.04.6 LTS, new server is Ubuntu 18.04.3 LTS.

We also copied existing exports to the new server in /usr/local/learninglocker/current/webapp/storage/downloads.

The only problem we've run into so far is attempting to generate new exports via Data > Source > Export panel.

What is the actual behaviour?

In the Downloads tab, new exports appear in the list, but the clock icon never disappears.

What is the expected behavior?

Exports are generated for download.

Is there any additional information that will help us replicate/understand the problem?

pm2 logs reports the following API error:

{ 
  message: 'Cannot read property \'split\' of undefined',
  stack: 'TypeError: Cannot read property \'split\' of undefined
    at SingleNested.Subdocument.isModified (/usr/local/learninglocker/releases/ll-20191226-de2193d10df0de45fc7e5d80b81f2292f6563f4b/webapp/node_modules/mongoose/lib/types/subdocument.js:120:51)
    at SingleNested.<anonymous> (/usr/local/learninglocker/releases/ll-20191226-de2193d10df0de45fc7e5d80b81f2292f6563f4b/webapp/node_modules/mongoose-timestamp/index.js:53:22)
    at callMiddlewareFunction (/usr/local/learninglocker/releases/ll-20191226-de2193d10df0de45fc7e5d80b81f2292f6563f4b/webapp/node_modules/kareem/index.js:482:23)
    at SingleNested.next (/usr/local/learninglocker/releases/ll-20191226-de2193d10df0de45fc7e5d80b81f2292f6563f4b/webapp/node_modules/kareem/index.js:58:7)
    at _next (/usr/local/learninglocker/releases/ll-20191226-de2193d10df0de45fc7e5d80b81f2292f6563f4b/webapp/node_modules/kareem/index.js:106:10)
    at process.nextTick (/usr/local/learninglocker/releases/ll-20191226-de2193d10df0de45fc7e5d80b81f2292f6563f4b/webapp/node_modules/kareem/index.js:507:38)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)' 
}

Looks like mongoose-timestamp is attempting to call isModified() for Subdocument, but mongoose itself expects params for isModified() for the Subdocument type. https://github.com/drudge/mongoose-timestamp/blob/v0.5.0/index.js#L53 https://github.com/Automattic/mongoose/blob/5.7.5/lib/types/subdocument.js#L118

package-lock.json reports these versions: mongoose-timestamp: 0.5.0 mongoose: 5.7.5

From the mongoose issue queue, this appears fixed in 5.7.6: https://github.com/Automattic/mongoose/issues/8251

Any help appreciated! Cheers and Happy New Year.

figureone avatar Jan 06 '20 19:01 figureone

Aloha, I just tested applying the patch from https://github.com/Automattic/mongoose/commit/875d681b06549a78215ef1543274517e52895dbd and restarted via pm2 restart all.

Exports now appear to be working.

figureone avatar Jan 06 '20 20:01 figureone