Skip to content

Commit 06a4460

Browse files
authored
Merge pull request #11698 from getsentry/prepare-release/8.0.0-beta.3
2 parents 2d56413 + 3b0e1b3 commit 06a4460

File tree

83 files changed

+1613
-692
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1613
-692
lines changed

.size-limit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ module.exports = [
208208
'tls',
209209
],
210210
gzip: true,
211-
limit: '160 KB',
211+
limit: '180 KB',
212212
},
213213
];
214214

CHANGELOG.md

+26
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,32 @@
44

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

7+
## 8.0.0-beta.3
8+
9+
### Important Changes
10+
11+
- **feat(opentelemetry): Add `addOpenTelemetryInstrumentation` (#11667)**
12+
13+
A utility function `addOpenTelemetryInstrumentation` was added that allows for the registration of instrumentations that
14+
conform to the OpenTelemetry JS API without having to specify `@opentelemetry/instrumentation` as a dependency.
15+
16+
- **ref(core): Don't start transaction for trpc middleware (#11697)**
17+
18+
Going forward, the Sentry `trpcMiddleware` will only create spans. Previously it used to always create a transaction.
19+
This change was made to integrate more nicely with the HTTP instrumentation added in earlier versions to avoid creating
20+
unnecessary transactions.
21+
22+
### Other Changes
23+
24+
- feat(nextjs): Instrument outgoing http requests (#11685)
25+
- feat(opentelemetry): Remove setupGlobalHub (#11668)
26+
- fix: Missing ErrorEvent export are added to node, browser, bun, deno, vercel-edge sub-packages (#11649)
27+
- fix(nextjs): Do not sample next spans if they have remote parent (#11680)
28+
- fix(nextjs): Re-enable OTEL fetch instrumentation and disable Next.js fetch instrumentation (#11686)
29+
- fix(node): Ensure DSC on envelope header uses root span (#11683)
30+
- ref(browser): Streamline pageload span creation and scope handling (#11679)
31+
- ref(core): Directly use endSession (#11669)
32+
733
## 8.0.0-beta.2
834

935
### Important Changes

dev-packages/browser-integration-tests/scripts/detectFlakyTests.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import * as glob from 'glob';
99
const NUM_BROWSERS = 3;
1010

1111
/**
12-
* Assume that each test runs for 3s.
12+
* Assume that each test runs for 2s.
1313
*/
14-
const ASSUMED_TEST_DURATION_SECONDS = 3;
14+
const ASSUMED_TEST_DURATION_SECONDS = 2;
1515

1616
/**
1717
* We keep the runtime of the detector if possible under 30min.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
5+
Sentry.init({
6+
dsn: 'https://[email protected]/1337',
7+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function run() {
2+
window.onerror({
3+
type: 'error',
4+
otherKey: 'hi',
5+
});
6+
}
7+
8+
run();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../../utils/fixtures';
5+
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
6+
7+
sentryTest(
8+
'should catch onerror calls with non-string first argument gracefully',
9+
async ({ getLocalTestPath, page }) => {
10+
const url = await getLocalTestPath({ testDir: __dirname });
11+
12+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
13+
14+
expect(eventData.exception?.values).toHaveLength(1);
15+
expect(eventData.exception?.values?.[0]).toMatchObject({
16+
type: 'Error',
17+
value: 'Object captured as exception with keys: otherKey, type',
18+
mechanism: {
19+
type: 'onerror',
20+
handled: false,
21+
},
22+
stacktrace: {
23+
frames: expect.any(Array),
24+
},
25+
});
26+
},
27+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function run() {
2+
try {
3+
try {
4+
foo();
5+
} catch (e) {
6+
Sentry.captureException(e);
7+
throw e; // intentionally re-throw
8+
}
9+
} catch (e) {
10+
// simulate window.onerror without generating a Script error
11+
window.onerror('error', 'file.js', 1, 1, e);
12+
}
13+
}
14+
15+
run();
16+
17+
Sentry.captureException(new Error('error 2'));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../../utils/fixtures';
5+
import { getMultipleSentryEnvelopeRequests } from '../../../../../utils/helpers';
6+
7+
sentryTest(
8+
'should NOT catch an exception already caught [but rethrown] via Sentry.captureException',
9+
async ({ getLocalTestPath, page }) => {
10+
const url = await getLocalTestPath({ testDir: __dirname });
11+
12+
const events = await getMultipleSentryEnvelopeRequests<Event>(page, 2, { url });
13+
14+
expect(events[0].exception?.values).toHaveLength(1);
15+
expect(events[0].exception?.values?.[0]).toMatchObject({
16+
type: 'ReferenceError',
17+
// this exact error message varies between browsers, but they should all reference 'foo'
18+
value: expect.stringContaining('foo'),
19+
mechanism: {
20+
type: 'generic',
21+
handled: true,
22+
},
23+
stacktrace: {
24+
frames: expect.any(Array),
25+
},
26+
});
27+
28+
// This is not a refernece error, but another generic error
29+
expect(events[1].exception?.values).toHaveLength(1);
30+
expect(events[1].exception?.values?.[0]).toMatchObject({
31+
type: 'Error',
32+
value: 'error 2',
33+
mechanism: {
34+
type: 'generic',
35+
handled: true,
36+
},
37+
stacktrace: {
38+
frames: expect.any(Array),
39+
},
40+
});
41+
},
42+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function run() {
2+
try {
3+
eval('foo{};');
4+
} catch (e) {
5+
// simulate window.onerror without generating a Script error
6+
window.onerror('error', 'file.js', 1, 1, e);
7+
}
8+
}
9+
10+
run();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../../utils/fixtures';
5+
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
6+
7+
sentryTest('should catch syntax errors', async ({ getLocalTestPath, page }) => {
8+
const url = await getLocalTestPath({ testDir: __dirname });
9+
10+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
11+
12+
expect(eventData.exception?.values).toHaveLength(1);
13+
expect(eventData.exception?.values?.[0]).toMatchObject({
14+
type: 'SyntaxError',
15+
value: "Unexpected token '{'",
16+
mechanism: {
17+
type: 'onerror',
18+
handled: false,
19+
},
20+
stacktrace: {
21+
frames: expect.any(Array),
22+
},
23+
});
24+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function run() {
2+
try {
3+
throw new Error('realError');
4+
} catch (e) {
5+
// simulate window.onerror without generating a Script error
6+
window.onerror('error', 'file.js', 1, 1, e);
7+
}
8+
}
9+
10+
run();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../../utils/fixtures';
5+
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
6+
7+
sentryTest('should catch thrown errors', async ({ getLocalTestPath, page }) => {
8+
const url = await getLocalTestPath({ testDir: __dirname });
9+
10+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
11+
12+
expect(eventData.exception?.values).toHaveLength(1);
13+
expect(eventData.exception?.values?.[0]).toMatchObject({
14+
type: 'Error',
15+
value: 'realError',
16+
mechanism: {
17+
type: 'onerror',
18+
handled: false,
19+
},
20+
stacktrace: {
21+
frames: expect.any(Array),
22+
},
23+
});
24+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function run() {
2+
try {
3+
throw { error: 'stuff is broken', somekey: 'ok' };
4+
} catch (e) {
5+
// simulate window.onerror without generating a Script error
6+
window.onerror('error', 'file.js', 1, 1, e);
7+
}
8+
}
9+
10+
run();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../../utils/fixtures';
5+
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
6+
7+
sentryTest('should catch thrown objects', async ({ getLocalTestPath, page }) => {
8+
const url = await getLocalTestPath({ testDir: __dirname });
9+
10+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
11+
12+
expect(eventData.exception?.values).toHaveLength(1);
13+
expect(eventData.exception?.values?.[0]).toMatchObject({
14+
type: 'Error',
15+
value: 'Object captured as exception with keys: error, somekey',
16+
mechanism: {
17+
type: 'onerror',
18+
handled: false,
19+
},
20+
stacktrace: {
21+
frames: expect.any(Array),
22+
},
23+
});
24+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function run() {
2+
try {
3+
throw 'stringError';
4+
} catch (e) {
5+
// simulate window.onerror without generating a Script error
6+
window.onerror('error', 'file.js', 1, 1, e);
7+
}
8+
}
9+
10+
run();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../../utils/fixtures';
5+
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
6+
7+
sentryTest('should catch thrown strings', async ({ getLocalTestPath, page }) => {
8+
const url = await getLocalTestPath({ testDir: __dirname });
9+
10+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
11+
12+
expect(eventData.exception?.values).toHaveLength(1);
13+
expect(eventData.exception?.values?.[0]).toMatchObject({
14+
type: 'Error',
15+
value: 'stringError',
16+
mechanism: {
17+
type: 'onerror',
18+
handled: false,
19+
},
20+
stacktrace: {
21+
frames: expect.any(Array),
22+
},
23+
});
24+
25+
expect(eventData.exception?.values?.[0].stacktrace?.frames).toHaveLength(1);
26+
});

0 commit comments

Comments
 (0)