Hide details about unexpected error from user

How do you deal with unexpected errors in production environment? We want to hide error messages (not to mention stack traces) from users and just tell them that some error happened and send the error details to log instead.

I managed to write a lambda function which is subscribed to CloudWatch logs of other functions and sends them to Papertrail but I don’t know how to remove their details from API Gateway output.

With the new proxy that should be possible. You can simply catch all errors yourself and then return a proper exit status. We want to make this a lot easier in the future through our SDK (that we’ll introduce at some point)

@flomotlik do you mean by using “Configure as proxy resource” amazon feature that is shown when create a resource option is chosen?
Thank you in advance

@endymion Serverless 1.0 supports Lambda proxy integration. You can catch any unhandled exceptions, log the stack trace (and anything else you want) then return a custom 500 error message to the user.

1 Like

Exactly what @buggy said