Picture of Richard Lilleker
Plugin Install Issue
by Richard Lilleker - Wednesday, 1 August 2018, 8:03 AM
 

Hi,

We installed Adapt on our server last week but we’ve been having problems with installation of plugins (both themes and extensions). After uploading the package, the “Plugin install failed” error appeared and the server fell over. However, upon restarting we noticed the plugin was visible in the UI.

Using a plugin or theme on a course then caused issues when attempting to generate a preview. We were getting errors like this:

 grunt server-build:prod --outputdir=courses/5b587e370fb4b31ef8f1a357/5b58806d58a7451f879fac08/build --theme=adapt-contrib-vanilla2 --menu=adapt-contrib-boxMenu

It seemed as though the plugins were not installing correctly and files were missing from the temp folder. We checked all permissions etc and ensured that all of the appropriate pre-requisites were installed correctly.

One of our guys has managed to produce a workaround fix, as follows:

Tracked it down to a piece of code that fails to get the 'tenantId' - the unique install ID directory that gets created <installroot>/temp/<tenantId>

Syslog entries for node server plugin upload

  -----------------------------

  node: /opt/adapt_authoring/plugins/content/bower/index.js:602

  node: : currentUser.tenant._id.toString()

  node:                     ^

  node: TypeError: Cannot read property '_id' of undefined

  -----------------------------

/opt/adapt_authoring/plugins/content/bower/index.js  (line 597 ...)

   // temporary hack to get stuff moving

   // copy plugin source to tenant dir

   var currentUser = usermanager.getCurrentUser();

   var tenantId = options.tenantId

     ? options.tenantId

     : currentUser.tenant._id.toString();

It would appear that 'tenantId' isn't defined in the function 'addPackage'

'options' parameter and also the getCurrentUser() call returns undef.  This causes the node server to fall over and results in a partially installed plugin / theme that's missing most of it's files.

I've temporarily hardcoded the current ID until (if) a proper fix is found.

   var tenantId = '5b5efc02c63ce074840d1f30';

 

Does anyone know if this is a common issue and is our workaround a plausible one?

Any advice would be greatly appreciated.

Thanks

Rich

Picture of Tom Taylor
Re: Plugin Install Issue
by Tom Taylor - Tuesday, 7 August 2018, 1:00 PM
 

Hi Rich,

I saw this issue recently, but couldn't pin it down to anything specific.

Can I check that your server is using Node.js v8.x.x -- I have a feeling this issue was related to my being on v6.x.x at the time.