-
Notifications
You must be signed in to change notification settings - Fork 634
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
X-Ray SDK propagates X-Ray Trace Header like: x-amzn-trace-id
OTel SDK propagates X-Ray Trace Header like: X-Amzn-Trace-Id
The current logic in middleware-recursion-detection
intends to inject trace ID to request header to detect recursion invocation in Lambda.
- This logic is skipped when
X-Amzn-Trace-Id
is set in the request headers. - This logic is not skipped when
x-amzn-trace-id
is set in the request headers, but it should, given that header checks should be case-insensitive
Regression Issue
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v20.10.0
Reproduction Steps
- Have LambdaX and LambdaY, LambdaX invokes LambdaY via Lambda
invoke
from@aws-sdk/client-lambda
, add permissions to LambdaX to useinvoke
. - Enable
Lambda service traces
in bothLambdaX
andLambdaY
- Enable
Application Signals
in LambdaX bothLambdaX
andLambdaY
- Invoke LambdaX function.
LambdaX Sample app: https://github.com/aws-observability/aws-otel-js-instrumentation/tree/main/lambda-layer/sample-apps/aws-sdk
(Replace s3.listbuckets
call with lambda.invoke(LambdaY)
call)
LambdaY Sample app: https://github.com/aws-observability/aws-otel-js-instrumentation/tree/main/lambda-layer/sample-apps/aws-sdk
Observed Behavior
middleware-recursion-detection
inject X-Ray Trace Header X-Amzn-Trace-Id
, this overwrites the x-amzn-trace-id
header set by OpenTelemetry sometime later since all headers are made case-insensitive/lowercase at some point later.
Expected Behavior
middleware-recursion-detection
shouldn't inject X-Ray Trace Header X-Amzn-Trace-Id
when x-amzn-trace-id
header is set by OpenTelemetry.
Possible Solution
Check for both X-Amzn-Trace-Id
and x-amzn-trace-id
headers in middleware-recursion-detection
.
OR
Have all header logic checks in middleware-recursion-detection
to be case-insensitive.
Additional Information/Context
No response