diff --git a/packages/aws-serverless/package.json b/packages/aws-serverless/package.json index 64f968291361..1f0ef4cf389e 100644 --- a/packages/aws-serverless/package.json +++ b/packages/aws-serverless/package.json @@ -73,7 +73,7 @@ "@sentry/core": "10.56.0", "@sentry/node": "10.56.0", "@sentry/node-core": "10.56.0", - "@types/aws-lambda": "^8.10.62" + "@types/aws-lambda": "^8.10.161" }, "devDependencies": { "@types/node": "^18.19.1", diff --git a/packages/aws-serverless/src/utils.ts b/packages/aws-serverless/src/utils.ts index f298a2bfec48..ff8e8810992b 100644 --- a/packages/aws-serverless/src/utils.ts +++ b/packages/aws-serverless/src/utils.ts @@ -40,7 +40,7 @@ export function markEventUnhandled(scope: Scope, type: string): Scope { * back to the `event`. * * When instrumenting the Lambda function with Sentry, the sentry trace data - * is placed on `context.clientContext.Custom`. Users are free to modify context + * is placed on `context.clientContext.custom`. Users are free to modify context * tho and provide this data via `event` or `context`. */ export function getAwsTraceData(event: HandlerEvent, context?: HandlerContext): TraceData { @@ -51,8 +51,8 @@ export function getAwsTraceData(event: HandlerEvent, context?: HandlerContext): baggage: headers.baggage, }; - if (context?.clientContext?.Custom) { - const customContext: Record = context.clientContext.Custom; + if (context?.clientContext?.custom) { + const customContext: Record = context.clientContext.custom; const sentryTrace = isString(customContext['sentry-trace']) ? customContext['sentry-trace'] : undefined; if (sentryTrace) { diff --git a/packages/aws-serverless/test/utils.test.ts b/packages/aws-serverless/test/utils.test.ts index e77171454a6a..f3e0f00dc97b 100644 --- a/packages/aws-serverless/test/utils.test.ts +++ b/packages/aws-serverless/test/utils.test.ts @@ -14,7 +14,7 @@ vi.mock('@opentelemetry/api', async () => { const mockContext = { clientContext: { - Custom: { + custom: { 'sentry-trace': '12345678901234567890123456789012-1234567890123456-1', baggage: 'sentry-environment=production', }, @@ -54,7 +54,7 @@ describe('getTraceData', () => { test('gets sentry trace data from the event if the context sentry trace is undefined', () => { const traceData = getAwsTraceData(mockEvent, { // @ts-expect-error, a partial context object is fine here - clientContext: { Custom: { 'sentry-trace': undefined, baggage: '' } }, + clientContext: { custom: { 'sentry-trace': undefined, baggage: '' } }, }); expect(traceData['sentry-trace']).toEqual('12345678901234567890123456789012-1234567890123456-2'); diff --git a/yarn.lock b/yarn.lock index 8395b0d2c76e..99085442331a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8900,10 +8900,10 @@ resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708" integrity sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw== -"@types/aws-lambda@^8.10.62": - version "8.10.150" - resolved "https://registry.yarnpkg.com/@types/aws-lambda/-/aws-lambda-8.10.150.tgz#4998b238750ec389a326a7cdb625808834036bd3" - integrity sha512-AX+AbjH/rH5ezX1fbK8onC/a+HyQHo7QGmvoxAE42n22OsciAxvZoZNEr22tbXs8WfP1nIsBjKDpgPm3HjOZbA== +"@types/aws-lambda@^8.10.161": + version "8.10.161" + resolved "https://registry.yarnpkg.com/@types/aws-lambda/-/aws-lambda-8.10.161.tgz#36d95723ec46d3d555bf0684f83cf4d4369a28ad" + integrity sha512-rUYdp+MQwSFocxIOcSsYSF3YYYC/uUpMbCY/mbO21vGqfrEYvNSoPyKYDj6RhXXpPfS0KstW9RwG3qXh9sL7FQ== "@types/babel__core@^7.20.1", "@types/babel__core@^7.20.4": version "7.20.5"