Skip to content

Commit 6a7d2f7

Browse files
committed
Attach defaulted command input back onto the command
Service hooks mutate commandInput (propagation headers, MessageAttributeNames, ClientContext); with a detached default those writes never reached the serialized request for input-less commands on older smithy clients.
1 parent 828e59f commit 6a7d2f7

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • packages/server-utils/src/integrations/tracing-channel/aws-sdk

packages/server-utils/src/integrations/tracing-channel/aws-sdk/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ const _awsChannelIntegration = (() => {
101101

102102
// Commands with all-optional members can be constructed without an input (`new
103103
// ListBucketsCommand()`); the OTel path traces those too, so default rather than bail.
104-
const normalizedRequest = normalizeV3Request(serviceName, commandName, command.input ?? {}, undefined);
104+
// The default is assigned back onto the command (not kept detached) because service hooks
105+
// mutate `commandInput` (trace-propagation headers, `MessageAttributeNames`) and those
106+
// writes must reach the serialized request. Current smithy clients already default `input`
107+
// to `{}` in the command constructor; this only affects older clients in our range.
108+
if (!command.input) {
109+
command.input = {};
110+
}
111+
const normalizedRequest = normalizeV3Request(serviceName, commandName, command.input, undefined);
105112
const requestMetadata = servicesExtensions.requestPreSpanHook(normalizedRequest);
106113

107114
const span = startInactiveSpan({

0 commit comments

Comments
 (0)