0.5.5: One of these should work: serverless -h, serverless --help, serverless help #1006

Closed
markstos opened this Issue Apr 14, 2016 · 13 comments

Projects

None yet

8 participants

@markstos

As tested with Node.jsj 4.4.2

It should be easy to get basic interactive help from the CLI, but all of these generate a stack dump.

serverless -h
serverless --help
serverless help

Here's an example result:

$ serverless --help
/home/mark/.nvm/versions/node/v4.4.1/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:61
        fn = function () { throw arg; };
                           ^

ServerlessError: Functions must have a runtime property as of Serverless v0.5
    at new ServerlessError (/home/mark/.nvm/versions/node/v4.4.1/lib/node_modules/serverless/lib/Error.js:17:11)
    at /home/mark/.nvm/versions/node/v4.4.1/lib/node_modules/serverless/lib/Serializer.js:76:23
From previous event:
    at processImmediate [as _immediateCallback] (timers.js:383:17)
[0]~/github-forks/astro-web ❤       -   ✎        ↑ +1 (master ᄉ origin)      
mark$ serverless -h
/home/mark/.nvm/versions/node/v4.4.1/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:61
        fn = function () { throw arg; };
                           ^

ServerlessError: Functions must have a runtime property as of Serverless v0.5
    at new ServerlessError (/home/mark/.nvm/versions/node/v4.4.1/lib/node_modules/serverless/lib/Error.js:17:11)
    at /home/mark/.nvm/versions/node/v4.4.1/lib/node_modules/serverless/lib/Serializer.js:76:23
From previous event:
    at processImmediate [as _immediateCallback] (timers.js:383:17)
@markstos

Oh, I think it's trying to tell me there's a problem with one of my functions file. (Mentioning the name of the functions file would be helpful).

This is still a bug related to generated help though: serverless shouldn't need to load my functions just return basic help.

@HyperBrain
Member

Yes, this is by design. Before any command line options are evaluated, the complete Serverless framework AND the project is initialized. That means, that any parse error of any project related file will lead to an unrecoverable exception and show a stack trace.
Looking at the current architecture it might be hard (but not impossible) to implement that.

@eahefnawy
Member

Yep it's by design ... loading the entire project first thing makes everything easier later on. It also informs the user very early on if something is not right in his config. Although I do agree you shouldn't need that when asking for help.

@flomotlik
Contributor

Just FYI this is going to get fixed in an upcoming release.

@flomotlik flomotlik added this to the 1.0 milestone May 12, 2016
@ialmetwally

Anyway to work around this issue? I've just updated to v0.5.5 and now stuck!

@markstos
markstos commented Jun 3, 2016

@ialmetwally The scope of this issue is about the help text not dispaying on the CLI. Are you stuck because you can't display --help ?

If your issue issue is that one of your config files is invalid and serverless is throwing an exception at start, that's a separate issue. Unfortunately, what happened to me, the message wasn't clear the file name at fault wasn't printed. You can try backing out your recent config file changes until serverless quits throwing exceptions. In any case, the scope of this issue is only that --help should always work.

@ialmetwally
ialmetwally commented Jun 3, 2016 edited

@markstos all serverless commands were not working for me, until I moved the s-resources.json file to the root directory, but now I'm stuck again because of the following exception when I try to execute "sls dash summary" I get the following error:

Serverless: 2 stages ------------------------------
/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:61
        fn = function () { throw arg; };
                           ^

TypeError: Cannot read property 'getAllRegions' of undefined
    at Project.getAllRegions (/usr/local/lib/node_modules/serverless/lib/Project.js:241:38)
    at /usr/local/lib/node_modules/serverless/lib/actions/DashSummary.js:61:38
    at Array.forEach (native)
    at DashSummary.dashSummary (/usr/local/lib/node_modules/serverless/lib/actions/DashSummary.js:59:14)
From previous event:
    at /usr/local/lib/node_modules/serverless/lib/Serverless.js:186:31
    at Array.reduce (native)
    at /usr/local/lib/node_modules/serverless/lib/Serverless.js:185:32
From previous event:
    at Serverless._execute (/usr/local/lib/node_modules/serverless/lib/Serverless.js:183:12)
    at Serverless.actions.(anonymous function) (/usr/local/lib/node_modules/serverless/lib/Serverless.js:429:20)
    at Serverless.command (/usr/local/lib/node_modules/serverless/lib/Serverless.js:398:38)
    at /usr/local/lib/node_modules/serverless/bin/serverless:19:16
    at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
    at Object.<anonymous> (/usr/local/lib/node_modules/serverless/bin/serverless:18:4)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:140:18)
    at node.js:1001:3
@markstos
markstos commented Jun 3, 2016

@ialmetwally the scope of this issue is only that --help should always work.

@ialmetwally

@markstos thanks I'll create a new issue

@andyfen
andyfen commented Jun 11, 2016

getting this error also

@bennybauer
Member

Looks like this one is already solved in 1.0.0-alpha.1

@pmuens
Member
pmuens commented Jul 7, 2016

@bennybauer Yes. We've implemented this in v1 👍 Thanks for pointing that out!

@flomotlik
Contributor

As this is fixed I'm going to close this issue.

@flomotlik flomotlik closed this Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment