Skip to content

Commit 12710e4

Browse files
authored
Merge branch 'develop' into abhi-vercel-ai
2 parents 24dc093 + 51e015c commit 12710e4

File tree

85 files changed

+1729
-92
lines changed

Some content is hidden

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

85 files changed

+1729
-92
lines changed

.craft.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,24 @@ targets:
157157
- nodejs20.x
158158
license: MIT
159159

160+
# NOTE: We publish the v8 layer under its own name so people on v8 can still get patches
161+
# whenever we release a new v8 version—otherwise we would overwrite the current major lambda layer.
162+
163+
# AWS Lambda Layer target
164+
- name: aws-lambda-layer
165+
includeNames: /^sentry-node-serverless-\d+.\d+.\d+(-(beta|alpha|rc)\.\d+)?\.zip$/
166+
layerName: SentryNodeServerlessSDKv8
167+
compatibleRuntimes:
168+
- name: node
169+
versions:
170+
- nodejs10.x
171+
- nodejs12.x
172+
- nodejs14.x
173+
- nodejs16.x
174+
- nodejs18.x
175+
- nodejs20.x
176+
license: MIT
177+
160178
# CDN Bundle Target
161179
- name: gcs
162180
id: 'browser-cdn-bundles'

.size-limit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ module.exports = [
7979
path: 'packages/browser/build/npm/esm/index.js',
8080
import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'replayCanvasIntegration'),
8181
gzip: true,
82-
limit: '79 KB',
82+
limit: '80 KB',
8383
},
8484
{
8585
name: '@sentry/browser (incl. Tracing, Replay, Feedback)',
@@ -166,7 +166,7 @@ module.exports = [
166166
name: 'CDN Bundle (incl. Tracing, Replay)',
167167
path: createCDNPath('bundle.tracing.replay.min.js'),
168168
gzip: true,
169-
limit: '74 KB',
169+
limit: '80 KB',
170170
},
171171
{
172172
name: 'CDN Bundle (incl. Tracing, Replay, Feedback)',
@@ -194,7 +194,7 @@ module.exports = [
194194
path: createCDNPath('bundle.tracing.replay.min.js'),
195195
gzip: false,
196196
brotli: false,
197-
limit: '230 KB',
197+
limit: '240 KB',
198198
},
199199
{
200200
name: 'CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed',

CHANGELOG.md

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

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

13+
### Important Changes
14+
15+
- **feat(nuxt): Add option autoInjectServerSentry (no default import()) ([#14553](https://github.com/getsentry/sentry-javascript/pull/14553))**
16+
17+
Using the dynamic `import()` as the default behavior for initializing the SDK on the server-side did not work for every project.
18+
The default behavior of the SDK has been changed, and you now need to **use the `--import` flag to initialize Sentry on the server-side** to leverage full functionality.
19+
20+
Example with `--import`:
21+
22+
```bash
23+
node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs
24+
```
25+
26+
In case you are not able to use the `--import` flag, you can enable auto-injecting Sentry in the `nuxt.config.ts` (comes with limitations):
27+
28+
```json
29+
sentry: {
30+
autoInjectServerSentry: 'top-level-import', // or 'experimental_dynamic-import'
31+
},
32+
```
33+
1334
Work in this release was contributed by @lsmurray. Thank you for your contribution!
1435

1536
## 8.42.0

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"dependencies": {
4343
"@babel/preset-typescript": "^7.16.7",
4444
"@playwright/test": "^1.44.1",
45-
"@sentry-internal/rrweb": "2.29.0",
45+
"@sentry-internal/rrweb": "2.30.0",
4646
"@sentry/browser": "8.42.0",
4747
"axios": "1.7.7",
4848
"babel-loader": "^8.2.2",
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 flagsIntegration = (window as any).Sentry.getClient().getIntegrationByName('FeatureFlags');
27+
for (let i = 1; i <= bufferSize; i++) {
28+
flagsIntegration.addFeatureFlag(`feat${i}`, false);
29+
}
30+
flagsIntegration.addFeatureFlag(`feat${bufferSize + 1}`, true); // eviction
31+
flagsIntegration.addFeatureFlag('feat3', true); // update
32+
return true;
33+
}, FLAG_BUFFER_SIZE);
34+
35+
const reqPromise = waitForErrorRequest(page);
36+
await page.locator('#error').click(); // trigger error
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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
5+
// Not using this as we want to test the getIntegrationByName() approach
6+
// window.sentryFeatureFlagsIntegration = Sentry.featureFlagsIntegration();
7+
8+
Sentry.init({
9+
dsn: 'https://[email protected]/1337',
10+
sampleRate: 1.0,
11+
integrations: [Sentry.featureFlagsIntegration()],
12+
});
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 flagsIntegration = (window as any).Sentry.getClient().getIntegrationByName('FeatureFlags');
32+
33+
flagsIntegration.addFeatureFlag('shared', true);
34+
35+
Sentry.withScope((scope: Scope) => {
36+
flagsIntegration.addFeatureFlag('forked', true);
37+
flagsIntegration.addFeatureFlag('shared', false);
38+
scope.setTag('isForked', true);
39+
if (errorButton) {
40+
errorButton.click();
41+
}
42+
});
43+
44+
flagsIntegration.addFeatureFlag('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+
});

dev-packages/e2e-tests/test-applications/nextjs-t3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"@sentry-internal/test-utils": "link:../../../test-utils",
3434
"@types/eslint": "^8.56.10",
3535
"@types/node": "^20.14.10",
36-
"@types/react": "^18.3.3",
36+
"@types/react": "18.3.1",
3737
"@types/react-dom": "^18.3.0",
3838
"@typescript-eslint/eslint-plugin": "^8.1.0",
3939
"@typescript-eslint/parser": "^8.1.0",

0 commit comments

Comments
 (0)