nodejitsu/forever — Issue #256: Uncaught exception when passing --log argument to node script with forever 0.8.5
Author: thauburger
Created: 2012-03-06 07:09:06+00:00
State: open

I just upgraded to forever v0.8.5. (Running node v0.6.12)

The script I would like to run accepts several command line arguments, including one denoted by **--log**:

E.g.

`forever start -m 10 server.js --log LOG_LEVEL`

After upgrading to v0.8.5, this now blows up with an uncaught exception:

````
{
"process": {
"pid": 4334,
"uid": 501,
"gid": 20,
"cwd": "/Users/thauburger/Desktop/foreverDebug",
"execPath": "/usr/bin/node",
"version": "v0.6.12",
"argv": [
"node",
"/usr/local/bin/forever",
"start",
"-m",
"10",
"server.js",
"--log",
"a"
],
"memoryUsage": {
"rss": 19677184,
"heapTotal": 14201920,
"heapUsed": 8282296
}
},
"os": {
"loadavg": [
0.439453125,
0.46826171875,
0.4306640625
],
"uptime": 88194
},
"trace": [
{
"column": null,
"file": null,
"function": "Function.keys",
"line": null,
"method": "keys",
"native": true
},
{
"column": 12,
"file": "/usr/lib/node_modules/forever/node_modules/utile/lib/index.js",
"function": null,
"line": 154,
"method": null,
"native": false
},
{
"column": null,
"file": null,
"function": "Array.forEach",
"line": null,
"method": "forEach",
"native": true
},
{
"column": 8,
"file": "/usr/lib/node_modules/forever/node_modules/utile/lib/index.js",
"function": "Object.mixin",
"line": 153,
"method": "mixin",
"native": false
},
{
"column": 22,
"file": "Object]. (/usr/lib/node_modules/forever/node_modules/broadway/lib/broadway/plugins/log.js",
"function": "[object",
"line": 37,
"method": null,
"native": false
},
{
"column": 31,
"file": "Object].use (/usr/lib/node_modules/forever/node_modules/broadway/lib/broadway/app.js",
"function": "[object",
"line": 161,
"method": null,
"native": false
},
{
"column": 9,
"file": "/usr/lib/node_modules/forever/node_modules/broadway/lib/broadway/bootstrapper.js",
"function": null,
"line": 43,
"method": null,
"native": false
},
{
"column": 30,
"file": "/usr/lib/node_modules/forever/node_modules/broadway/lib/broadway/plugins/config.js",
"function": null,
"line": 44,
"method": null,
"native": false
},
{
"column": 32,
"file": "/usr/lib/node_modules/forever/node_modules/nconf/lib/nconf/provider.js",
"function": null,
"line": 329,
"method": null,
"native": false
},
{
"column": 13,
"file": "/usr/lib/node_modules/forever/node_modules/nconf/node_modules/async/lib/async.js",
"function": null,
"line": 190,
"method": null,
"native": false
}
],
"stack": [
"TypeError: Object.keys called on non-object",
" at Function.keys (native)",
" at /usr/lib/node_modules/forever/node_modules/utile/lib/index.js:154:12",
" at Array.forEach (native)",
" at Object.mixin (/usr/lib/node_modules/forever/node_modules/utile/lib/index.js:153:8)",
" at [object Object]. (/usr/lib/node_modules/forever/node_modules/broadway/lib/broadway/plugins/log.js:37:22)",
" at [object Object].use (/usr/lib/node_modules/forever/node_modules/broadway/lib/broadway/app.js:161:31)",
" at /usr/lib/node_modules/forever/node_modules/broadway/lib/broadway/bootstrapper.js:43:9",
" at /usr/lib/node_modules/forever/node_modules/broadway/lib/broadway/plugins/config.js:44:30",
" at /usr/lib/node_modules/forever/node_modules/nconf/lib/nconf/provider.js:329:32",
" at /usr/lib/node_modules/forever/node_modules/nconf/node_modules/async/lib/async.js:190:13"
],
"level": "error",
"message": "uncaughtException"
}

````

I can reproduce this crasher 100% by passing a --log command line argument to **any** node.js script.

Is forever attempting to consume the --log argument for itself regardless? And if so, did I miss this as a documented restriction?

My understanding is that any arguments passed **after** the script name will be treated as arguments to that script.

Any insight would be a huge help!

Thanks!

Tom