Skip to content

Commit b986eae

Browse files
authored
Merge pull request #8754 from getsentry/prepare-release/7.62.0
meta: Update CHANGELOG for version 7.62.0
2 parents aec068c + 9070e3e commit b986eae

File tree

115 files changed

+1688
-1189
lines changed

Some content is hidden

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

115 files changed

+1688
-1189
lines changed

.craft.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
minVersion: '0.23.1'
22
changelogPolicy: simple
33
preReleaseCommand: bash scripts/craft-pre-release.sh
4+
statusProvider:
5+
name: github
6+
config:
7+
contexts:
8+
- job_required_jobs_passed
49
targets:
510
# NPM Targets
611
## 1. Base Packages, node or browser SDKs depend on

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ jobs:
599599
needs: [job_get_metadata, job_build]
600600
if: needs.job_get_metadata.outputs.changed_browser == 'true' || github.event_name != 'pull_request'
601601
runs-on: ubuntu-20.04
602-
timeout-minutes: 10
602+
timeout-minutes: 20
603603
strategy:
604604
fail-fast: false
605605
matrix:
@@ -855,8 +855,8 @@ jobs:
855855
timeout-minutes: 5
856856
run: yarn test:assert
857857

858-
job_required_tests:
859-
name: All required tests passed or skipped
858+
job_required_jobs_passed:
859+
name: All required jobs passed or were skipped
860860
needs:
861861
[
862862
job_build,
@@ -870,6 +870,9 @@ jobs:
870870
job_browser_loader_tests,
871871
job_remix_integration_tests,
872872
job_e2e_tests,
873+
job_artifacts,
874+
job_lint,
875+
job_circular_dep_check,
873876
]
874877
# Always run this, even if a dependent job failed
875878
if: always()

CHANGELOG.md

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

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

7+
## 7.62.0
8+
9+
### Important Changes
10+
11+
- **feat(integrations): Add `ContextLines` integration for html-embedded JS stack frames (#8699)**
12+
13+
This release adds the `ContextLines` integration as an optional integration for the Browser SDKs to `@sentry/integrations`.
14+
15+
This integration adds source code from inline JavaScript of the current page's HTML (e.g. JS in `<script>` tags) to stack traces of captured errors.
16+
It _can't_ collect source code from assets referenced by your HTML (e.g. `<script src="..." />`).
17+
18+
The `ContextLines` integration is useful when you have inline JS code in HTML pages that can't be accessed by Sentry's backend, for example, due to a login-protected page.
19+
20+
```js
21+
import { ContextLines } from "@sentry/integrations";
22+
23+
Sentry.init({
24+
// ...
25+
integrations: [
26+
new ContextLines({
27+
// The number of lines to collect before and after each stack frame's line number
28+
// Defaults to 7
29+
frameContextLines: 7,
30+
}),
31+
],
32+
});
33+
```
34+
35+
### Other Changes
36+
37+
- fix(nextjs): Make all wrappers isomorphic and available in all runtimes (#8743)
38+
- fix(replay): Cancel debounce when replay is too short/long (#8742)
39+
- fix(utils): `dirname` and `basename` should handle Windows paths (#8737)
40+
- ref: Hoist `flush`, `close`, and `lastEventId` into `@sentry/core` (#8731)
41+
- ref(node): Don't call `JSON.stringify` on prisma client when logging (#8745)
42+
743
## 7.61.1
844

945
- feat(nextjs): Add `AsyncLocalStorage` async context strategy to edge SDK (#8720)

packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/get/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import type { Event } from '@sentry/types';
44
import { sentryTest } from '../../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
66

7-
sentryTest('captures Breadcrumb for basic GET request', async ({ getLocalTestPath, page }) => {
8-
const url = await getLocalTestPath({ testDir: __dirname });
7+
sentryTest('captures Breadcrumb for basic GET request', async ({ getLocalTestUrl, page }) => {
8+
const url = await getLocalTestUrl({ testDir: __dirname });
99

1010
await page.route('**/foo', route => {
1111
return route.fulfill({

packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/post/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import type { Event } from '@sentry/types';
44
import { sentryTest } from '../../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
66

7-
sentryTest('captures Breadcrumb for POST request', async ({ getLocalTestPath, page }) => {
8-
const url = await getLocalTestPath({ testDir: __dirname });
7+
sentryTest('captures Breadcrumb for POST request', async ({ getLocalTestUrl, page }) => {
8+
const url = await getLocalTestUrl({ testDir: __dirname });
99

1010
await page.route('**/foo', route => {
1111
return route.fulfill({

packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/get/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import type { Event } from '@sentry/types';
44
import { sentryTest } from '../../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
66

7-
sentryTest('captures Breadcrumb for basic GET request', async ({ getLocalTestPath, page }) => {
8-
const url = await getLocalTestPath({ testDir: __dirname });
7+
sentryTest('captures Breadcrumb for basic GET request', async ({ getLocalTestUrl, page }) => {
8+
const url = await getLocalTestUrl({ testDir: __dirname });
99

1010
await page.route('**/foo', route => {
1111
return route.fulfill({

packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/post/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import type { Event } from '@sentry/types';
44
import { sentryTest } from '../../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
66

7-
sentryTest('captures Breadcrumb for POST request', async ({ getLocalTestPath, page }) => {
8-
const url = await getLocalTestPath({ testDir: __dirname });
7+
sentryTest('captures Breadcrumb for POST request', async ({ getLocalTestUrl, page }) => {
8+
const url = await getLocalTestUrl({ testDir: __dirname });
99

1010
await page.route('**/foo', route => {
1111
return route.fulfill({
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as Sentry from '@sentry/browser';
2+
import { ContextLines } from '@sentry/integrations';
3+
4+
window.Sentry = Sentry;
5+
6+
Sentry.init({
7+
dsn: 'https://[email protected]/1337',
8+
integrations: [new ContextLines()],
9+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
</head>
6+
<body>
7+
<button id="inline-error-btn" onclick="throw new Error('Error with context lines')">Click me</button>
8+
</body>
9+
<footer>
10+
Some text...
11+
</foot>
12+
</html>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { expect } from '@playwright/test';
2+
3+
import { sentryTest } from '../../../../utils/fixtures';
4+
import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../utils/helpers';
5+
6+
sentryTest(
7+
'should add source context lines around stack frames from errors in Html inline JS',
8+
async ({ getLocalTestPath, page, browserName }) => {
9+
if (browserName === 'webkit') {
10+
// The error we're throwing in this test is thrown as "Script error." in Webkit.
11+
// We filter "Script error." out by default in `InboundFilters`.
12+
// I don't think there's much value to disable InboundFilters defaults for this test,
13+
// given that most of our users won't do that either.
14+
// Let's skip it instead for Webkit.
15+
sentryTest.skip();
16+
}
17+
18+
const url = await getLocalTestPath({ testDir: __dirname });
19+
20+
const eventReqPromise = waitForErrorRequestOnUrl(page, url);
21+
22+
const clickPromise = page.click('#inline-error-btn');
23+
24+
const [req] = await Promise.all([eventReqPromise, clickPromise]);
25+
26+
const eventData = envelopeRequestParser(req);
27+
28+
expect(eventData.exception?.values).toHaveLength(1);
29+
30+
const exception = eventData.exception?.values?.[0];
31+
32+
expect(exception).toMatchObject({
33+
stacktrace: {
34+
frames: [
35+
{
36+
pre_context: ['<!DOCTYPE html>', '<html>', '<head>', ' <meta charset="utf-8">', ' </head>', ' <body>'],
37+
context_line:
38+
' <button id="inline-error-btn" onclick="throw new Error(\'Error with context lines\')">Click me</button>',
39+
post_context: [
40+
expect.stringContaining('<script'), // this line varies in the test based on tarball/cdn bundle (+variants)
41+
' <footer>',
42+
' Some text...',
43+
' ',
44+
'',
45+
'</footer></body>',
46+
'</html>',
47+
],
48+
},
49+
],
50+
},
51+
});
52+
},
53+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
document.getElementById('script-error-btn').addEventListener('click', () => {
2+
throw new Error('Error without context lines');
3+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
</head>
6+
<body>
7+
<button id="script-error-btn">Click me</button>
8+
</body>
9+
<footer>
10+
Some text...
11+
</foot>
12+
</html>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { expect } from '@playwright/test';
2+
3+
import { sentryTest } from '../../../../utils/fixtures';
4+
import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../utils/helpers';
5+
6+
sentryTest('should not add source context lines to errors from script files', async ({ getLocalTestPath, page }) => {
7+
const url = await getLocalTestPath({ testDir: __dirname });
8+
9+
const eventReqPromise = waitForErrorRequestOnUrl(page, url);
10+
11+
const clickPromise = page.click('#script-error-btn');
12+
13+
const [req] = await Promise.all([eventReqPromise, clickPromise]);
14+
15+
const eventData = envelopeRequestParser(req);
16+
17+
const exception = eventData.exception?.values?.[0];
18+
const frames = exception?.stacktrace?.frames;
19+
expect(frames).toHaveLength(1);
20+
frames?.forEach(f => {
21+
expect(f).not.toHaveProperty('pre_context');
22+
expect(f).not.toHaveProperty('context_line');
23+
expect(f).not.toHaveProperty('post_context');
24+
});
25+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<script>
6+
function throwTestError() {
7+
throw new Error('Error with context lines')
8+
}
9+
</script>
10+
</head>
11+
<body>
12+
<button id="inline-error-btn" onclick="throwTestError()">Click me</button>
13+
</body>
14+
<footer>
15+
Some text...
16+
</foot>
17+
</html>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import { expect } from '@playwright/test';
2+
3+
import { sentryTest } from '../../../../utils/fixtures';
4+
import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../utils/helpers';
5+
6+
sentryTest(
7+
'should add source context lines around stack frames from errors in Html script tags',
8+
async ({ getLocalTestPath, page, browserName }) => {
9+
if (browserName === 'webkit') {
10+
// The error we're throwing in this test is thrown as "Script error." in Webkit.
11+
// We filter "Script error." out by default in `InboundFilters`.
12+
// I don't think there's much value to disable InboundFilters defaults for this test,
13+
// given that most of our users won't do that either.
14+
// Let's skip it instead for Webkit.
15+
sentryTest.skip();
16+
}
17+
18+
const url = await getLocalTestPath({ testDir: __dirname });
19+
20+
const eventReqPromise = waitForErrorRequestOnUrl(page, url);
21+
22+
const clickPromise = page.click('#inline-error-btn');
23+
24+
const [req] = await Promise.all([eventReqPromise, clickPromise]);
25+
26+
const eventData = envelopeRequestParser(req);
27+
28+
expect(eventData.exception?.values).toHaveLength(1);
29+
30+
const exception = eventData.exception?.values?.[0];
31+
32+
expect(exception).toMatchObject({
33+
stacktrace: {
34+
frames: [
35+
{
36+
lineno: 12,
37+
pre_context: [
38+
' <script>',
39+
' function throwTestError() {',
40+
" throw new Error('Error with context lines')",
41+
' }',
42+
' </script>',
43+
' </head>',
44+
' <body>',
45+
],
46+
context_line: ' <button id="inline-error-btn" onclick="throwTestError()">Click me</button>',
47+
post_context: [
48+
expect.stringContaining('<script'), // this line varies in the test based on tarball/cdn bundle (+variants)
49+
' <footer>',
50+
' Some text...',
51+
' ',
52+
'',
53+
'</footer></body>',
54+
'</html>',
55+
],
56+
},
57+
{
58+
lineno: 7,
59+
pre_context: [
60+
'<!DOCTYPE html>',
61+
'<html>',
62+
'<head>',
63+
' <meta charset="utf-8">',
64+
' <script>',
65+
' function throwTestError() {',
66+
],
67+
context_line: " throw new Error('Error with context lines')",
68+
post_context: [
69+
' }',
70+
' </script>',
71+
' </head>',
72+
' <body>',
73+
' <button id="inline-error-btn" onclick="throwTestError()">Click me</button>',
74+
expect.stringContaining('<script'), // this line varies in the test based on tarball/cdn bundle (+variants)
75+
' <footer>',
76+
],
77+
},
78+
],
79+
},
80+
});
81+
},
82+
);

packages/browser/src/exports.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ export {
2626
captureException,
2727
captureEvent,
2828
captureMessage,
29+
close,
2930
configureScope,
3031
createTransport,
32+
flush,
3133
getHubFromCarrier,
3234
getCurrentHub,
3335
Hub,
36+
lastEventId,
3437
makeMain,
3538
Scope,
3639
startTransaction,
@@ -60,16 +63,5 @@ export {
6063
} from './stack-parsers';
6164
export { eventFromException, eventFromMessage } from './eventbuilder';
6265
export { createUserFeedbackEnvelope } from './userfeedback';
63-
export {
64-
defaultIntegrations,
65-
forceLoad,
66-
init,
67-
lastEventId,
68-
onLoad,
69-
showReportDialog,
70-
flush,
71-
close,
72-
wrap,
73-
captureUserFeedback,
74-
} from './sdk';
66+
export { defaultIntegrations, forceLoad, init, onLoad, showReportDialog, wrap, captureUserFeedback } from './sdk';
7567
export { GlobalHandlers, TryCatch, Breadcrumbs, LinkedErrors, HttpContext, Dedupe } from './integrations';

0 commit comments

Comments
 (0)