Skip to content

Commit 98cf7fe

Browse files
committed
Remove as any cast and reuse CommandInput in messaging extensions
1 parent 7bb8530 commit 98cf7fe

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export function injectPropagationContext(
5050

5151
if (Object.keys(attributes).length + headerKeys.length <= MAX_MESSAGE_ATTRIBUTES) {
5252
for (const key of headerKeys) {
53-
(attributes as AwsSdkContextObject)[key] = { DataType: 'String', StringValue: headers[key] } as any;
53+
// Index-assigning into the SQS/SNS map union needs one concrete map type; the written value
54+
// shape is valid for both.
55+
(attributes as SQS.MessageBodyAttributeMap)[key] = { DataType: 'String', StringValue: headers[key] };
5456
}
5557
} else {
5658
DEBUG_BUILD &&

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
URL_FULL,
1010
} from '@sentry/conventions/attributes';
1111
import type { SQS } from '../aws-sdk.types';
12-
import type { NormalizedRequest, NormalizedResponse } from '../types';
12+
import type { CommandInput, NormalizedRequest, NormalizedResponse } from '../types';
1313
import {
1414
addPropagationFieldsToAttributeNames,
1515
extractPropagationHeaders,
@@ -122,7 +122,7 @@ export class SqsServiceExtension implements ServiceExtension {
122122
}
123123
}
124124

125-
function extractQueueUrl(commandInput: Record<string, any>): string {
125+
function extractQueueUrl(commandInput: CommandInput): string {
126126
return commandInput?.QueueUrl;
127127
}
128128

0 commit comments

Comments
 (0)