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

Parsing [XXX] in error messages, to match serverless 1.0 #133

Merged
merged 2 commits into from
Nov 2, 2016

Conversation

marccampbell
Copy link
Contributor

This fixes #108

There are a few ways this could be accomplished. Is this an acceptable solution?

This isn't a significant change, but when an error message is being returned from a serverless handler, if there's a "[XXX] Message" in the response, the status code on the response object will be set from this error object.

It makes no attempt to response the different patterns that serverless supports with API Gateway. I feel that this is out of scope of this PR and could be an interesting option by itself.

@leonardoalifraco
Copy link
Contributor

This behavior is only valid for the lambda integration type.

@dherault If you decide to merge this before #131 let me know and I'll make the proper adjustments in my PR.

@dherault
Copy link
Owner

Hi @marccampbell, thanks a lot for the PR.
Let's wait for the lambda integration feature before merging this one.

@dherault
Copy link
Owner

@marccampbell Ok I merged the integrations PRs #129 and #131. Can you fix the conflicts please? Extra kudos if you write some tests 👍, thanks

@dherault
Copy link
Owner

dherault commented Nov 1, 2016

@marccampbell Is this ready? I can merge it today
Also, it('should set the status code to 500 when no [xxx] is present', ...) is it the case on AWS?

@leonardoalifraco
Copy link
Contributor

leonardoalifraco commented Nov 2, 2016

@dherault @marccampbell I've tested this and I think it is ok.
However, after merging it, we'll need to make a few changes to the change that was before @marccampbell changes in order to match the exact response for errors.

IE:
When the error callback receives an string, we are returning:

{
  "errorMessage": "[504] Fake internal server error.",
  "errorType": "String",
  "stackTrace": null
}

But we should be returning only the errorMessage:

{
  "errorMessage": "[504] Fake internal server error."
}

I'll merge it and then change adapt the string response.

Thanks!

@leonardoalifraco leonardoalifraco merged commit 6d0ce0b into dherault:master Nov 2, 2016
@demetriusnunes
Copy link
Contributor

Thanks guys, super awesome!

@dherault
Copy link
Owner

dherault commented Nov 3, 2016

Oh right, forgot to say: v3.3.0 ;)

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

Successfully merging this pull request may close these issues.

Status codes are not being picked up from error message
4 participants