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 f181ece
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 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 @@ -223,7 +223,6 @@ AWS.EventListeners = {
functionName.length > 0 &&
typeof traceId === 'string' &&
traceId.length > 0 &&
!Object.hasOwnProperty.call(req.httpRequest.headers, traceIdHeaderName)
) {
req.httpRequest.headers[traceIdHeaderName] = traceId;
}
Expand Down

0 comments on commit f181ece

Please sign in to comment.