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

Avoid logging certain exceptions thrown by AWS Lambda handlers #24847

Closed
emattheis opened this issue Apr 8, 2022 · 1 comment · Fixed by #24919
Closed

Avoid logging certain exceptions thrown by AWS Lambda handlers #24847

emattheis opened this issue Apr 8, 2022 · 1 comment · Fixed by #24919
Labels
Milestone

Comments

@emattheis
Copy link
Contributor

Description

The AWS Lambda extension currently handles exceptions thrown by RequestHandler implementations in a uniform manner by logging the execution failure along with the stacktrace. In some cases, however, raising an exception is the expected way to provide a negative response to the caller - e.g. https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-pre-authentication.html#aws-lambda-triggers-pre-authentication-example. In these cases, it's undesirable to have the exception logged. Suppressing the AbstractLambdaPollLoop logger via configuration is an option, of course, but then you have to be sure to catch and log any exceptions you actually want to report in your handler code.

It would be great if the logic in the poll loop could make a determination about whether or not to log the exception in a configurable/programmable way.

Implementation ideas

My first thought is to introduce a specialized RuntimeException type that developers can throw directly, or extend with their own exceptions. This makes the logic in AbstractLambdaPollLoop trivial, but would mean writing Quarkus-specific handlers.

An alternative would be to allow the configuration of arbitrary exceptions by class name that the extensions should ignore.

@emattheis emattheis added the kind/enhancement New feature or request label Apr 8, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 8, 2022

/cc @matejvasek, @patriot1burke

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

Successfully merging a pull request may close this issue.

1 participant