You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The AWS Lambda Extensions API seems to set the tracing field in the INVOKE event for Lambda extensions even if X-Ray active tracing is disabled for the Lambda function and the requesting service (e.g., API Gateway) doesn't provide tracing headers. It's unclear where the trace ID originates, but I confirmed that it's present even when X-Ray is disabled. When I searched the trace ID in the X-Ray console, it didn't find anything, suggesting that the AWS Lambda service generates a new trace ID when none is provided.
However, the emulator omits this field when the request doesn't include an X-Amzn-Trace-Id header:
When locally testing Lambda extensions using the Rust runtime and the AWS SAM CLI's sam local command, extensions fail with a "missing field tracing" error. The same extensions work fine in production.
Since this incompatibility is due to a behavioral difference between the AWS Lambda service in production and the emulator, I think it's ultimately a bug in the emulator, rather than the Rust runtime being overly strict.
I'd suggest changing the NewXRayTracing function to generate a trace ID when none is provided, rather than returning nil.
The text was updated successfully, but these errors were encountered:
The AWS Lambda Extensions API seems to set the
tracing
field in theINVOKE
event for Lambda extensions even if X-Ray active tracing is disabled for the Lambda function and the requesting service (e.g., API Gateway) doesn't provide tracing headers. It's unclear where the trace ID originates, but I confirmed that it's present even when X-Ray is disabled. When I searched the trace ID in the X-Ray console, it didn't find anything, suggesting that the AWS Lambda service generates a new trace ID when none is provided.However, the emulator omits this field when the request doesn't include an
X-Amzn-Trace-Id
header:aws-lambda-runtime-interface-emulator/lambda/rapi/rendering/rendering.go
Line 144 in 2057ada
aws-lambda-runtime-interface-emulator/lambda/rapi/model/tracing.go
Lines 30 to 33 in 2057ada
This behavior breaks compatibility with the AWS Lambda Rust Runtime, which expects the
tracing
field (cc @calavera):https://github.com/awslabs/aws-lambda-rust-runtime/blob/ab3b809d63fad05369596d17ad4fc449f7035e5e/lambda-extension/src/events.rs#L23
When locally testing Lambda extensions using the Rust runtime and the AWS SAM CLI's
sam local
command, extensions fail with a "missing fieldtracing
" error. The same extensions work fine in production.Since this incompatibility is due to a behavioral difference between the AWS Lambda service in production and the emulator, I think it's ultimately a bug in the emulator, rather than the Rust runtime being overly strict.
I'd suggest changing the
NewXRayTracing
function to generate a trace ID when none is provided, rather than returningnil
.The text was updated successfully, but these errors were encountered: