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

Improved error messages about payload deserialization #905

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,9 @@ async fn main() -> Result<(), Error> {
}
```

The subscriber uses `RUST_LOG` as the environment variable to determine the log level for your function. It also uses [Lambda's advance logging controls](https://aws.amazon.com/blogs/compute/introducing-advanced-logging-controls-for-aws-lambda-functions/) if they're configured for your function. By default, the log level to emit events is `INFO`.
The subscriber uses `RUST_LOG` environment variable to determine the log level for your function. It also uses [Lambda's advanced logging controls](https://aws.amazon.com/blogs/compute/introducing-advanced-logging-controls-for-aws-lambda-functions/), if configured.

By default, the log level to emit events is `INFO`. Log at `TRACE` level for more detail, including a dump of the raw payload.

## AWS event objects

Expand Down
4 changes: 2 additions & 2 deletions lambda-runtime/src/layers/api_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ where
Ok(())
};
if let Err(err) = trace_fn() {
error!(error = ?err, "failed to parse raw JSON event received from Lambda");
error!(error = ?err, "Failed to parse raw JSON event received from Lambda. The handler will not be called. Log at TRACE level to see the payload.");
return RuntimeApiResponseFuture::Ready(Some(Err(err)));
};

Expand All @@ -124,7 +124,7 @@ fn build_event_error_request<'a, T>(request_id: &'a str, err: T) -> Result<http:
where
T: Into<Diagnostic<'a>> + Debug,
{
error!(error = ?err, "building error response for Lambda Runtime API");
error!(error = ?err, "Request payload deserialization into LambdaEvent<T> failed. The handler will not be called. Log at TRACE level to see the payload.");
EventErrorRequest::new(request_id, err).into_req()
}

Expand Down
Loading