Skip to content

Commit

Permalink
address feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP committed May 29, 2022
1 parent ca07707 commit 40c6e51
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/event_listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ AWS.EventListeners = {
});

add('SET_TRACE_ID', 'afterBuild', function SET_TRACE_ID(req) {
if (AWS.util.isNode()) {
if (AWS.util.isNode() && !Object.hasOwnProperty.call(req.httpRequest.headers, traceIdHeaderName)) {
var ENV_LAMBDA_FUNCTION_NAME = 'AWS_LAMBDA_FUNCTION_NAME';
var ENV_TRACE_ID = '_X_AMZN_TRACE_ID';
var traceIdHeaderName = 'X-Amzn-Trace-Id';
Expand All @@ -222,8 +222,7 @@ AWS.EventListeners = {
typeof functionName === 'string' &&
functionName.length > 0 &&
typeof traceId === 'string' &&
traceId.length > 0 &&
!Object.hasOwnProperty.call(req.httpRequest.headers, traceIdHeaderName)
traceId.length > 0
) {
req.httpRequest.headers[traceIdHeaderName] = traceId;
}
Expand Down

0 comments on commit 40c6e51

Please sign in to comment.