Skip to content

Commit 3a8655a

Browse files
author
Luca Forstner
authored
Merge branch 'develop' into lforst-request-session-deprecations
2 parents 3442ff7 + 92ce807 commit 3a8655a

File tree

180 files changed

+3150
-877
lines changed

Some content is hidden

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

180 files changed

+3150
-877
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,10 @@ jobs:
14081408
key: ${{ needs.job_build.outputs.dependency_cache_key }}
14091409
enableCrossOsArchive: true
14101410

1411+
- name: Increase yarn network timeout on Windows
1412+
if: contains(matrix.os, 'windows')
1413+
run: yarn config set network-timeout 600000 -g
1414+
14111415
- name: Install dependencies
14121416
env:
14131417
SKIP_PLAYWRIGHT_BROWSER_INSTALL: "1"
@@ -1418,10 +1422,6 @@ jobs:
14181422
run: |
14191423
git config --global --add safe.directory "*"
14201424
1421-
- name: Increase yarn network timeout on Windows
1422-
if: contains(matrix.os, 'windows')
1423-
run: yarn config set network-timeout 600000 -g
1424-
14251425
- name: Setup python
14261426
uses: actions/setup-python@v5
14271427
if: ${{ !contains(matrix.container, 'alpine') }}

.github/workflows/issue-package-label.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ jobs:
8383
"@sentry.solid": {
8484
"label": "Package: solidstart"
8585
},
86-
"@sentry.svelte": {
87-
"label": "Package: svelte"
88-
},
8986
"@sentry.sveltekit": {
9087
"label": "Package: sveltekit"
9188
},
89+
"@sentry.svelte": {
90+
"label": "Package: svelte"
91+
},
9292
"@sentry.vue": {
9393
"label": "Package: vue"
9494
},

.size-limit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ module.exports = [
228228
import: createImport('init'),
229229
ignore: [...builtinModules, ...nodePrefixedBuiltinModules],
230230
gzip: true,
231-
limit: '140 KB',
231+
limit: '160 KB',
232232
},
233233
{
234234
name: '@sentry/node - without tracing',
@@ -260,7 +260,7 @@ module.exports = [
260260
import: createImport('init'),
261261
ignore: [...builtinModules, ...nodePrefixedBuiltinModules],
262262
gzip: true,
263-
limit: '130 KB',
263+
limit: '150 KB',
264264
},
265265
];
266266

CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,59 @@
1010

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

13+
Work in this release was contributed by @lsmurray. Thank you for your contribution!
14+
15+
## 8.42.0
16+
17+
### Important Changes
18+
19+
- **feat(react): React Router v7 support (library) ([#14513](https://github.com/getsentry/sentry-javascript/pull/14513))**
20+
21+
This release adds support for [React Router v7 (library mode)](https://reactrouter.com/home#react-router-as-a-library).
22+
Check out the docs on how to set up the integration: [Sentry React Router v7 Integration Docs](https://docs.sentry.io/platforms/javascript/guides/react/features/react-router/v7/)
23+
24+
### Deprecations
25+
26+
- **feat: Warn about source-map generation ([#14533](https://github.com/getsentry/sentry-javascript/pull/14533))**
27+
28+
In the next major version of the SDK we will change how source maps are generated when the SDK is added to an application.
29+
Currently, the implementation varies a lot between different SDKs and can be difficult to understand.
30+
Moving forward, our goal is to turn on source maps for every framework, unless we detect that they are explicitly turned off.
31+
Additionally, if we end up enabling source maps, we will emit a log message that we did so.
32+
33+
With this particular release, we are emitting warnings that source map generation will change in the future and we print instructions on how to prepare for the next major.
34+
35+
- **feat(nuxt): Deprecate `tracingOptions` in favor of `vueIntegration` ([#14530](https://github.com/getsentry/sentry-javascript/pull/14530))**
36+
37+
Currently it is possible to configure tracing options in two places in the Sentry Nuxt SDK:
38+
39+
- In `Sentry.init()`
40+
- Inside `tracingOptions` in `Sentry.init()`
41+
42+
For tree-shaking purposes and alignment with the Vue SDK, it is now recommended to instead use the newly exported `vueIntegration()` and its `tracingOptions` option to configure tracing options in the Nuxt SDK:
43+
44+
```ts
45+
// sentry.client.config.ts
46+
import * as Sentry from '@sentry/nuxt';
47+
48+
Sentry.init({
49+
// ...
50+
integrations: [
51+
Sentry.vueIntegration({
52+
tracingOptions: {
53+
trackComponents: true,
54+
},
55+
}),
56+
],
57+
});
58+
```
59+
60+
### Other Changes
61+
62+
- feat(browser-utils): Update `web-vitals` to v4.2.4 ([#14439](https://github.com/getsentry/sentry-javascript/pull/14439))
63+
- feat(nuxt): Expose `vueIntegration` ([#14526](https://github.com/getsentry/sentry-javascript/pull/14526))
64+
- fix(feedback): Handle css correctly in screenshot mode ([#14535](https://github.com/getsentry/sentry-javascript/pull/14535))
65+
1366
## 8.41.0
1467

1568
### Important Changes

dev-packages/browser-integration-tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry-internal/browser-integration-tests",
3-
"version": "8.41.0",
3+
"version": "8.42.0",
44
"main": "index.js",
55
"license": "MIT",
66
"engines": {
@@ -43,7 +43,7 @@
4343
"@babel/preset-typescript": "^7.16.7",
4444
"@playwright/test": "^1.44.1",
4545
"@sentry-internal/rrweb": "2.29.0",
46-
"@sentry/browser": "8.41.0",
46+
"@sentry/browser": "8.42.0",
4747
"axios": "1.7.7",
4848
"babel-loader": "^8.2.2",
4949
"html-webpack-plugin": "^5.5.0",
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { expect } from '@playwright/test';
2+
3+
import { sentryTest } from '../../../../../utils/fixtures';
4+
5+
import { envelopeRequestParser, shouldSkipFeatureFlagsTest, waitForErrorRequest } from '../../../../../utils/helpers';
6+
7+
const FLAG_BUFFER_SIZE = 100; // Corresponds to constant in featureFlags.ts, in browser utils.
8+
9+
sentryTest('Basic test with eviction, update, and no async tasks', async ({ getLocalTestUrl, page }) => {
10+
if (shouldSkipFeatureFlagsTest()) {
11+
sentryTest.skip();
12+
}
13+
14+
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
15+
return route.fulfill({
16+
status: 200,
17+
contentType: 'application/json',
18+
body: JSON.stringify({ id: 'test-id' }),
19+
});
20+
});
21+
22+
const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true });
23+
await page.goto(url);
24+
25+
await page.evaluate(bufferSize => {
26+
const ldClient = (window as any).initializeLD();
27+
for (let i = 1; i <= bufferSize; i++) {
28+
ldClient.variation(`feat${i}`, false);
29+
}
30+
ldClient.variation(`feat${bufferSize + 1}`, true); // eviction
31+
ldClient.variation('feat3', true); // update
32+
return true;
33+
}, FLAG_BUFFER_SIZE);
34+
35+
const reqPromise = waitForErrorRequest(page);
36+
await page.locator('#error').click();
37+
const req = await reqPromise;
38+
const event = envelopeRequestParser(req);
39+
40+
const expectedFlags = [{ flag: 'feat2', result: false }];
41+
for (let i = 4; i <= FLAG_BUFFER_SIZE; i++) {
42+
expectedFlags.push({ flag: `feat${i}`, result: false });
43+
}
44+
expectedFlags.push({ flag: `feat${FLAG_BUFFER_SIZE + 1}`, result: true });
45+
expectedFlags.push({ flag: 'feat3', result: true });
46+
47+
expect(event.contexts?.flags?.values).toEqual(expectedFlags);
48+
});
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
window.sentryLDIntegration = Sentry.launchDarklyIntegration();
5+
6+
Sentry.init({
7+
dsn: 'https://[email protected]/1337',
8+
sampleRate: 1.0,
9+
integrations: [window.sentryLDIntegration],
10+
});
11+
12+
// Manually mocking this because LD only has mock test utils for the React SDK.
13+
// Also, no SDK has mock utils for FlagUsedHandler's.
14+
const MockLaunchDarkly = {
15+
initialize(_clientId, context, options) {
16+
const flagUsedHandler = options && options.inspectors ? options.inspectors[0].method : undefined;
17+
18+
return {
19+
variation(key, defaultValue) {
20+
if (flagUsedHandler) {
21+
flagUsedHandler(key, { value: defaultValue }, context);
22+
}
23+
return defaultValue;
24+
},
25+
};
26+
},
27+
};
28+
29+
window.initializeLD = () => {
30+
return MockLaunchDarkly.initialize(
31+
'example-client-id',
32+
{ kind: 'user', key: 'example-context-key' },
33+
{ inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()] },
34+
);
35+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
document.getElementById('error').addEventListener('click', () => {
2+
throw new Error('Button triggered error');
3+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
</head>
6+
<body>
7+
<button id="error">Throw Error</button>
8+
</body>
9+
</html>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { expect } from '@playwright/test';
2+
3+
import { sentryTest } from '../../../../../utils/fixtures';
4+
5+
import { envelopeRequestParser, shouldSkipFeatureFlagsTest, waitForErrorRequest } from '../../../../../utils/helpers';
6+
7+
import type { Scope } from '@sentry/browser';
8+
9+
sentryTest('Flag evaluations in forked scopes are stored separately.', async ({ getLocalTestUrl, page }) => {
10+
if (shouldSkipFeatureFlagsTest()) {
11+
sentryTest.skip();
12+
}
13+
14+
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
15+
return route.fulfill({
16+
status: 200,
17+
contentType: 'application/json',
18+
body: JSON.stringify({ id: 'test-id' }),
19+
});
20+
});
21+
22+
const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true });
23+
await page.goto(url);
24+
25+
const forkedReqPromise = waitForErrorRequest(page, event => !!event.tags && event.tags.isForked === true);
26+
const mainReqPromise = waitForErrorRequest(page, event => !!event.tags && event.tags.isForked === false);
27+
28+
await page.evaluate(() => {
29+
const Sentry = (window as any).Sentry;
30+
const errorButton = document.querySelector('#error') as HTMLButtonElement;
31+
const ldClient = (window as any).initializeLD();
32+
33+
ldClient.variation('shared', true);
34+
35+
Sentry.withScope((scope: Scope) => {
36+
ldClient.variation('forked', true);
37+
ldClient.variation('shared', false);
38+
scope.setTag('isForked', true);
39+
if (errorButton) {
40+
errorButton.click();
41+
}
42+
});
43+
44+
ldClient.variation('main', true);
45+
Sentry.getCurrentScope().setTag('isForked', false);
46+
errorButton.click();
47+
return true;
48+
});
49+
50+
const forkedReq = await forkedReqPromise;
51+
const forkedEvent = envelopeRequestParser(forkedReq);
52+
53+
const mainReq = await mainReqPromise;
54+
const mainEvent = envelopeRequestParser(mainReq);
55+
56+
expect(forkedEvent.contexts?.flags?.values).toEqual([
57+
{ flag: 'forked', result: true },
58+
{ flag: 'shared', result: false },
59+
]);
60+
61+
expect(mainEvent.contexts?.flags?.values).toEqual([
62+
{ flag: 'shared', result: true },
63+
{ flag: 'main', result: true },
64+
]);
65+
});

0 commit comments

Comments
 (0)