Reputation: 128
Has anyone had problems with adding Monitoring and Analytics as a service and causing #bluemix apps to crash? I have a NodeJS app and as soon as I added M&A, the app will no longer load.
Thanks.
It looks like it's crashing because of an error in POST with mongoose. I'm looking at it right now on whether it is just mongoose or how Bluemix is handling the error. I've found a few github discussions:
https://github.com/Automattic/mongoose/issues/3391 Error: invalid json with multer and body-parser
2015-11-12T15:35:02.722-0500[App/0]ERR/home/vcap/app/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:58
2015-11-12T15:35:02.722-0500[App/0]ERR at model._next (/home/vcap/app/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:58:23)
2015-11-12T15:35:02.722-0500[App/0]ERR at /home/vcap/app/node_modules/mongoose/lib/document.js:1721:23
2015-11-12T15:35:02.722-0500[App/0]ERR throw new Error("Your pre must have a next argument -- e.g., f
2015-11-12T15:35:02.722-0500[App/0]ERR ^
2015-11-12T15:35:02.722-0500[App/0]ERR at /home/vcap/app/node_modules/mongoose/node_modules/kareem/index.js:177:19
2015-11-12T15:35:02.722-0500[App/0]ERR at model.proto.(anonymous function) [as $__original_save] (/home/vcap/app/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:108:20)
2015-11-12T15:35:02.722-0500[App/0]ERRError: Your pre must have a next argument -- e.g., function (next, ...)
2015-11-12T15:35:02.722-0500[App/0]ERR at model.wrappedPointCut [as save] (/home/vcap/app/node_modules/mongoose/lib/document.js:1703:14)
2015-11-12T15:35:02.722-0500[App/0]ERR at Query.<anonymous> (/home/vcap/app/controllers/users.js:173:18)
2015-11-12T15:35:02.722-0500[App/0]ERR at /home/vcap/app/node_modules/mongoose/node_modules/kareem/index.js:109:16
2015-11-12T15:35:02.722-0500[App/0]ERR at new Promise.ES6 (/home/vcap/app/node_modules/mongoose/lib/promise.js:45:3)
2015-11-12T15:35:02.722-0500[App/0]ERR at process._tickDomainCallback (node.js:381:11)
I don't know if this should be crashing the entire instance. Shouldn't Bluemix be more resilient?
Upvotes: 1
Views: 226
Reputation: 128
Added error handing to next event. We need to get Bluemix to dump errors instead of crashing.
Upvotes: 0
Reputation: 56
Are you using free plan or diagnostics plan? If you are using diagnostics plan, you might need a larger Memory (my suggestion is 1G by now), because the diagnostics plan generated huge data.
If you are using free plan, then you might need to check the push application way.
For Node.js, you might need to write a file which name is Procfile which content is the command line you run the application:
here is an example:
web: node app.js
In packages.json, scripts field is also required:
here is an example:
"scripts": {
"start": "node app"
},
In manifest.yml, you should add the M&A Services's name
here is an example:
applications:
- disk_quota: 1024M
host: xxxx
name: xxxx
path: .
domain: xxxx.mybluemix.net
instances: 1
memory: 1024M
services:
- Monitoring and Analytics-xxx
- mongodb-xx
After complete these three changes, please delete your previous application first, then push it again:
first:
cf delete <appname>
then:
cf push
If these cannot make your application works, please feel free to contact me.
Upvotes: 1