Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/aws-serverless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/aws-serverless/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -51,8 +51,8 @@ export function getAwsTraceData(event: HandlerEvent, context?: HandlerContext):
baggage: headers.baggage,
};

if (context?.clientContext?.Custom) {
const customContext: Record<string, unknown> = context.clientContext.Custom;
if (context?.clientContext?.custom) {
const customContext: Record<string, unknown> = context.clientContext.custom;
const sentryTrace = isString(customContext['sentry-trace']) ? customContext['sentry-trace'] : undefined;

if (sentryTrace) {
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-serverless/test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vi.mock('@opentelemetry/api', async () => {

const mockContext = {
clientContext: {
Custom: {
custom: {
'sentry-trace': '12345678901234567890123456789012-1234567890123456-1',
baggage: 'sentry-environment=production',
},
Expand Down Expand Up @@ -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');
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading