Skip to content

Commit 4ee10b0

Browse files
authored
Improved payload Deser error messages (#905)
* made error messages more informative * added a suggestion to log at TRACE level to README
1 parent c4594f7 commit 4ee10b0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ async fn main() -> Result<(), Error> {
306306
}
307307
```
308308

309-
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`.
309+
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.
310+
311+
By default, the log level to emit events is `INFO`. Log at `TRACE` level for more detail, including a dump of the raw payload.
310312

311313
## AWS event objects
312314

lambda-runtime/src/layers/api_response.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ where
9898
Ok(())
9999
};
100100
if let Err(err) = trace_fn() {
101-
error!(error = ?err, "failed to parse raw JSON event received from Lambda");
101+
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.");
102102
return RuntimeApiResponseFuture::Ready(Some(Err(err)));
103103
};
104104

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

0 commit comments

Comments
 (0)