Picture of Jorge Castrillo
Error: Already found extension article attribute with key ...
by Jorge Castrillo - Wednesday, 12 December 2018, 9:42 PM
 

Hi Guys,

I was update my AT From 0.4.1 to 0.6.0 and the update was find. But now i have a problem using the app. When i try to login the CLI show me this error.

Actually i use an extension named _bsa but i dont know waht happend now.

error: [12 Dec 2018 21:34:10 +00:00] Error: Already found extension article attribute with key _bsa (trainin-blocksequential-advance)
Error: Already found extension article attribute with key _bsa (trainin-blocksequential-advance)
    at /home/ubuntu/html/adapt_trainin/lib/contentmanager.js:695:31
    at /home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:3110:16
    at eachOfArrayLike (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:1069:9)
    at eachOf (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:1117:5)
    at Object.eachLimit (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:3172:5)
    at processPluginLocations (/home/ubuntu/html/adapt_trainin/lib/contentmanager.js:682:13)
    at processPlugin (/home/ubuntu/html/adapt_trainin/lib/contentmanager.js:645:7)
    at /home/ubuntu/html/adapt_trainin/lib/contentmanager.js:629:15
    at /home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:3110:16
    at replenish (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:1011:17)
    at /home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:1016:9
    at eachLimit$1 (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:3196:24)
    at Object.<anonymous> (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:1046:16)
    at /home/ubuntu/html/adapt_trainin/lib/contentmanager.js:628:19
    at /home/ubuntu/html/adapt_trainin/node_modules/mongoose/lib/model.js:4528:16
    at (anonymous function).call (/home/ubuntu/html/adapt_trainin/node_modules/mongoose/lib/query.js:3819:7)
    at /home/ubuntu/html/adapt_trainin/node_modules/mongoose/lib/query.js:3842:12
    at process.nextTick (/home/ubuntu/html/adapt_trainin/node_modules/mongoose/lib/helpers/query/completeMany.js:35:39)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickDomainCallback (internal/process/next_tick.js:219:9)

error: [12 Dec 2018 21:34:10 +00:00] Error: Already found extension article attribute with key _bsa (trainin-blocksequential-advance)
Error: Already found extension article attribute with key _bsa (trainin-blocksequential-advance)
    at /home/ubuntu/html/adapt_trainin/lib/contentmanager.js:695:31
    at /home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:3110:16
    at eachOfArrayLike (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:1069:9)
    at eachOf (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:1117:5)
    at Object.eachLimit (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:3172:5)
    at processPluginLocations (/home/ubuntu/html/adapt_trainin/lib/contentmanager.js:682:13)
    at processPlugin (/home/ubuntu/html/adapt_trainin/lib/contentmanager.js:645:7)
    at /home/ubuntu/html/adapt_trainin/lib/contentmanager.js:629:15
    at /home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:3110:16
    at replenish (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:1011:17)
    at /home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:1016:9
    at eachLimit$1 (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:3196:24)
    at Object.<anonymous> (/home/ubuntu/html/adapt_trainin/node_modules/async/dist/async.js:1046:16)
    at /home/ubuntu/html/adapt_trainin/lib/contentmanager.js:628:19
    at /home/ubuntu/html/adapt_trainin/node_modules/mongoose/lib/model.js:4528:16
    at (anonymous function).call (/home/ubuntu/html/adapt_trainin/node_modules/mongoose/lib/query.js:3819:7)
    at /home/ubuntu/html/adapt_trainin/node_modules/mongoose/lib/query.js:3842:12
    at process.nextTick (/home/ubuntu/html/adapt_trainin/node_modules/mongoose/lib/helpers/query/completeMany.js:35:39)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickDomainCallback (internal/process/next_tick.js:219:9)

Picture of Jorge Castrillo
Re: Error: Already found extension article attribute with key ...
by Jorge Castrillo - Thursday, 13 December 2018, 7:53 PM
 

Can someone explain to me exactly what this function does and why my error originates?

I changed this part of the code...

if(typeObj[key] &&_.intersection(Object.keys(typeObj[key]), keys).length>0) {
returneachCallback(newError(`Already found ${pluginType}${key} attribute with key ${keys[0]} (${schema.name})`));
} elseif(!typeObj) {
memo.contentModelData[pluginType] =typeObj= {};
}
 
.. because of this and my AT seems to work normally, however, it is not clear to me if what I am doing is fine ...
 
 if(!typeObj) {
memo.contentModelData[pluginType] =typeObj= {};
}
 
Someone help me please
 
function processPluginLocations(pPluginType, schema, memo, callback) {
varpluginType=pPluginType.type;
try {
varschemaPluginLocations=schema.properties.pluginLocations.properties;
} catch(e) { // handle undefined pluginLocations
if(!_.isEmpty(schema.properties)) { // in case we have an empty pluginLocations
deleteschema.properties.pluginLocations;
memo.schemas[schema[pluginType]] =schema;
}
returncallback();
}
async.each(Object.keys(schemaPluginLocations), function(key, eachCallback) {
varprops=schemaPluginLocations[key].properties;
if (!props) {
returneachCallback();
}
varkeys=Object.keys(props);
// NOTE we need a single top-level object
if(keys.length>1) {
returneachCallback(newError(`Expected 1 property, found ${keys.length}`));
}
vartypeObj=memo.contentModelData[pluginType];
// don't overwrite an existing attribute
if(typeObj[key] &&_.intersection(Object.keys(typeObj[key]), keys).length>0) {
returneachCallback(newError(`Already found ${pluginType}${key} attribute with key ${keys[0]} (${schema.name})`));
} elseif(!typeObj) {
memo.contentModelData[pluginType] =typeObj= {};
}
// NOTE this is needed to check against applied menu/theme in schemas.js
props[keys[0]].name=schema.name;

typeObj[key] =_.extend({}, typeObj[key], props);
eachCallback();

}, function(error) {
if(error) returncallback(error);
// remove pluginLocations and store plugin schema
deleteschema.properties.pluginLocations;
if(!_.isEmpty(schema.properties)) {
memo.schemas[schema[pluginType]] =schema;
}
callback();
});
}