Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve responses in invoke local #2620

Closed
ac360 opened this issue Nov 4, 2016 · 2 comments
Closed

Improve responses in invoke local #2620

ac360 opened this issue Nov 4, 2016 · 2 comments
Assignees
Milestone

Comments

@ac360
Copy link
Member

ac360 commented Nov 4, 2016

This is a proposal

Description

When invoking a function remotely via serverless invoke, it returns ONLY the response, whether that be an error or a success message.

When invoking a local function via invoke local, it returns things differently:

  • On success, invoke local returns the response, but right before that it prints:
Serverless: successfully invoked your function

This should be removed. The first reason is that it's obvious whether it has succeeded or failed. The second reason is that there are a lot of plugins that want to parse the response from the invoke command, but if we put Serverless statements in that response, it makes it really hard to parse, since the CLI standard output has to be parsed and the log statement is mixed in with the that.

  • On error, it returns an error that looks like something went wrong with the Serverless Framework, not the user's code:
$ sls invoke local -f connect
 
  Syntax Error -------------------------------------------
 
     Unexpected token u in JSON at position 0
 
     For debugging logs, run again after setting SLS_DEBUG env var.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
 
     Please report this error. We think it might be a bug.
 
  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       6.6.0
     Serverless Version: 1.1.0

This isn't the right experience. We should catch the error and return a specific looking error that explains the code is wrong, the line, stacktrace, etc...

@flomotlik flomotlik added this to the 1.2 milestone Nov 4, 2016
@eahefnawy
Copy link
Member

@ac360 👍 👍 👍 agreed on both points

@horike37
Copy link
Member

@ac360 @eahefnawy
I implemented. Please review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants