Skip to content

Commit 2e9c3bf

Browse files
authored
Merge branch 'develop' into first-round-v5
2 parents a0ad1d7 + f8390ae commit 2e9c3bf

File tree

25 files changed

+741
-157
lines changed

25 files changed

+741
-157
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7+
Work in this release was contributed by @Karibash. Thank you for your contribution!
8+
79
## 10.5.0
810

911
- feat(core): better cause data extraction ([#17375](https://github.com/getsentry/sentry-javascript/pull/17375))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const handler = async () => {
2+
throw new Error('test esm');
3+
};

dev-packages/e2e-tests/test-applications/aws-serverless/src/lambda-functions-layer/TracingEsm/index.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as Sentry from '@sentry/aws-serverless';
22

33
import * as http from 'node:http';
44

5-
export const handler = Sentry.wrapHandler(async () => {
5+
export const handler = async () => {
66
await Sentry.startSpan({ name: 'manual-span', op: 'test' }, async () => {
77
await new Promise(resolve => {
88
http.get('http://example.com', res => {
@@ -16,4 +16,4 @@ export const handler = Sentry.wrapHandler(async () => {
1616
});
1717
});
1818
});
19-
});
19+
};

dev-packages/e2e-tests/test-applications/aws-serverless/src/lambda-functions-npm/TracingCjs/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const http = require('http');
22
const Sentry = require('@sentry/aws-serverless');
33

4-
exports.handler = Sentry.wrapHandler(async () => {
4+
exports.handler = async () => {
55
await new Promise(resolve => {
66
const req = http.request(
77
{
@@ -21,4 +21,4 @@ exports.handler = Sentry.wrapHandler(async () => {
2121
});
2222

2323
Sentry.startSpan({ name: 'manual-span', op: 'manual' }, () => {});
24-
});
24+
};

dev-packages/e2e-tests/test-applications/aws-serverless/src/lambda-functions-npm/TracingEsm/index.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as http from 'node:http';
22
import * as Sentry from '@sentry/aws-serverless';
33

4-
export const handler = Sentry.wrapHandler(async () => {
4+
export const handler = async () => {
55
await new Promise(resolve => {
66
const req = http.request(
77
{
@@ -21,4 +21,4 @@ export const handler = Sentry.wrapHandler(async () => {
2121
});
2222

2323
Sentry.startSpan({ name: 'manual-span', op: 'manual' }, () => {});
24-
});
24+
};

dev-packages/e2e-tests/test-applications/aws-serverless/tests/layer.test.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,35 @@ test.describe('Lambda layer', () => {
160160
type: 'Error',
161161
value: 'test',
162162
mechanism: {
163-
type: 'auto.function.aws-serverless.handler',
163+
type: 'auto.function.aws-serverless.otel',
164+
handled: false,
165+
},
166+
}),
167+
);
168+
});
169+
170+
test('capturing errors works in ESM', async ({ lambdaClient }) => {
171+
const errorEventPromise = waitForError('aws-serverless-lambda-sam', errorEvent => {
172+
return errorEvent?.exception?.values?.[0]?.value === 'test esm';
173+
});
174+
175+
await lambdaClient.send(
176+
new InvokeCommand({
177+
FunctionName: 'LayerErrorEsm',
178+
Payload: JSON.stringify({}),
179+
}),
180+
);
181+
182+
const errorEvent = await errorEventPromise;
183+
184+
// shows the SDK sent an error event
185+
expect(errorEvent.exception?.values).toHaveLength(1);
186+
expect(errorEvent.exception?.values?.[0]).toEqual(
187+
expect.objectContaining({
188+
type: 'Error',
189+
value: 'test esm',
190+
mechanism: {
191+
type: 'auto.function.aws-serverless.otel',
164192
handled: false,
165193
},
166194
}),

dev-packages/e2e-tests/test-applications/browser-webworker-vite/src/worker.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as Sentry from '@sentry/browser';
22

3-
// type cast necessary because TS thinks this file is part of the main
4-
// thread where self is of type `Window` instead of `Worker`
5-
Sentry.registerWebWorker({ self: self as unknown as Worker });
3+
Sentry.registerWebWorker({ self });
64

75
// Let the main thread know the worker is ready
86
self.postMessage({

dev-packages/e2e-tests/test-applications/browser-webworker-vite/src/worker2.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as Sentry from '@sentry/browser';
22

3-
// type cast necessary because TS thinks this file is part of the main
4-
// thread where self is of type `Window` instead of `Worker`
5-
Sentry.registerWebWorker({ self: self as unknown as Worker });
3+
Sentry.registerWebWorker({ self });
64

75
// Let the main thread know the worker is ready
86
self.postMessage({

dev-packages/e2e-tests/test-applications/browser-webworker-vite/src/worker3.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as Sentry from '@sentry/browser';
22

3-
// type cast necessary because TS thinks this file is part of the main
4-
// thread where self is of type `Window` instead of `Worker`
5-
Sentry.registerWebWorker({ self: self as unknown as Worker });
3+
Sentry.registerWebWorker({ self });
64

75
// Let the main thread know the worker is ready
86
self.postMessage({

dev-packages/e2e-tests/test-applications/browser-webworker-vite/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"target": "ES2022",
44
"useDefineForClassFields": true,
55
"module": "ESNext",
6-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
7-
"skipLibCheck": true,
6+
"lib": ["ES2022", "DOM", "DOM.Iterable", "WebWorker"],
7+
"skipLibCheck": false,
8+
"skipDefaultLibCheck": true,
89

910
/* Bundler mode */
1011
"moduleResolution": "bundler",

0 commit comments

Comments
 (0)