-
Notifications
You must be signed in to change notification settings - Fork 228
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
nodejs12 (and nodejs14) templates only return error 500 on context.fail() #257
Comments
This is expected behaviour, but I can see why you are confused by it. We'll take a look at it, but are open to taking a PR if you wanted to first propose how you think it should work? Alex |
Maybe i misunderstood, but i saw it more as a way to exit the handler in any non-OK state (not 2xx or 3xx), with the ability of returning a status code and message. This is also the idea i got from this blog post, which actually has the exact What it does now is return a 500 and |
Would you be open to taking a look into this and sending in a PR @hrak? |
I can take a stab at it! |
…penfaas#257 Signed-off-by: Hans Rakers <hans@shoq.com>
This is fixed by #262 I thought we'd waited long enough given how useful this could be for other users. If you value our work and the project then please become a GitHub Sponsor |
The nodejs templates currently return a
500 Internal Server Error
in all cases (and do not output supplied result) on a call tocontext.fail()
F.e. on a return statement like this:
return context.status(405).fail({"status": "method not allowed"})
:Expected Behaviour
Current Behaviour
Possible Solution
My guess is that the arguments on this line need to be reversed
Steps to Reproduce (for bugs)
Use the following handler.js and do a GET request on it.
Context
Trying to return a 405 error on invalid method, but always getting a
500 Internal Server Error
with[object Object]
as bodyYour Environment
The text was updated successfully, but these errors were encountered: