Hi folks,
I'm trying to set up my cloud application with pm2 in cluster mode, so, i'm getting the error below:
TypeError: Cannot convert undefined or null to object app-1 at Function.keys (native) app-1 at Object.replaceAll (/home/ubuntu/appcloud/node_modules/atlassian-connect-express/lib/internal/utils.js:12:12) app-1 at module.exports (/home/ubuntu/appcloud/node_modules/atlassian-connect-express/lib/internal/config.js:13:28) app-1 at EventEmitter.Addon (/home/ubuntu/appcloud/node_modules/atlassian-connect-express/lib/index.js:29:19) app-1 at module.exports (/home/ubuntu/appcloud/node_modules/atlassian-connect-express/lib/index.js:197:12) app-1 at Object.<anonymous> (/home/ubuntu/appcloud/app.js:54:13) app-1 at Module._compile (module.js:409:26) app-1 at Object.Module._extensions..js (module.js:416:10) app-1 at Module.load (module.js:343:32) app-1 at Function.Module._load (module.js:300:12) app-1 at Function._load (/usr/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21) app-1 at /usr/lib/node_modules/pm2/lib/ProcessContainer.js:217:23 app-1 at /usr/lib/node_modules/pm2/node_modules/async/lib/async.js:52:16 app-1 at /usr/lib/node_modules/pm2/node_modules/async/lib/async.js:1209:30 app-1 at WriteStream.<anonymous> (/usr/lib/node_modules/pm2/lib/Utility.js:131:13) app-1 at emitOne (events.js:77:13)
If I run that using node app.js it runs well.
Any suggestion?
Thank you.
Cheers,
RMRodrigues
Community moderators have prevented the ability to post new answers.
Hi @Rui Rodrigues, it seems that the line of code that is causing the issue is:
var modeValues = utils.replaceAll(config[mode] || config['development'], env);
Specifically that:
config[mode] || config['development']
Returns null or an empty object. The config variable is loaded as so:
var config = utils.loadJSON('config.json');
And the utils.loadJSON method swallows errors at the moment and therefore you would not be able to see that the config.json file is failing to be read when you are running your pm2 cluster nodes.
Thus, I suspect that the problem is that your pm2 cluster nodes cannot find or cannot read the config.json file. Please double check that the pm2 cluster nodes can access that file by trying to read in your own code and let me know if that is the issue.. Cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.