Skip to content

Commit 8145fb2

Browse files
authored
Merge branch 'develop' into onur/remix-express-formdata
2 parents 5ec2c0f + 24c4eba commit 8145fb2

File tree

100 files changed

+1068
-1939
lines changed

Some content is hidden

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

100 files changed

+1068
-1939
lines changed

MIGRATION.md

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ stable release of `8.x` comes out).
2020

2121
## 1. Version Support changes:
2222

23-
**Node.js**: We now official support Node 14.8+ for our CJS package, and Node 18.8+ for our ESM package. This applies to
24-
`@sentry/node` and all of our node-based server-side sdks (`@sentry/nextjs`, `@sentry/serverless`, etc.). We no longer
25-
test against Node 8, 10, or 12 and cannot guarantee that the SDK will work as expected on these versions.
23+
**Node.js**: We now official support Node 14.18+ for our CJS package, and Node 18.8+ for our ESM package. This applies
24+
to `@sentry/node` and all of our node-based server-side sdks (`@sentry/nextjs`, `@sentry/serverless`, etc.). We no
25+
longer test against Node 8, 10, or 12 and cannot guarantee that the SDK will work as expected on these versions.
2626

2727
**Browser**: Our browser SDKs (`@sentry/browser`, `@sentry/react`, `@sentry/vue`, etc.) now require ES2017+ compatible
2828
browsers. This means that we no longer support IE11 (end of an era). This also means that the Browser SDK requires the
@@ -254,6 +254,7 @@ We now support the following integrations out of the box:
254254
- [Browser SDK](./MIGRATION.md#browser-sdk-browser-react-vue-angular-ember-etc)
255255
- [Server-side SDKs (Node, Deno, Bun)](./MIGRATION.md#server-side-sdks-node-deno-bun-etc)
256256
- [Next.js SDK](./MIGRATION.md#nextjs-sdk)
257+
- [SvelteKit SDK](./MIGRATION.md#sveltekit-sdk)
257258
- [Astro SDK](./MIGRATION.md#astro-sdk)
258259

259260
### General
@@ -581,6 +582,78 @@ Sentry.init({
581582
});
582583
```
583584

585+
### SvelteKit SDK
586+
587+
#### Breaking `sentrySvelteKit()` changes
588+
589+
We upgraded the `@sentry/vite-plugin` which is a dependency of the SvelteKit SDK from version 0.x to 2.x. With this
590+
change, resolving uploaded source maps should work out of the box much more often than before
591+
([more information](https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/artifact-bundles/)).
592+
593+
To allow future upgrades of the Vite plugin without breaking stable and public APIs in `sentrySvelteKit`, we modified
594+
the `sourceMapsUploadOptions` to remove the hard dependency on the API of the plugin. While you previously could specify
595+
all [version 0.x Vite plugin options](https://www.npmjs.com/package/@sentry/vite-plugin/v/0.6.1), we now reduced them to
596+
a subset of [2.x options](https://www.npmjs.com/package/@sentry/vite-plugin/v/2.14.2#options). All of these options are
597+
optional just like before but here's an example of using the new options.
598+
599+
```js
600+
// Before (v7):
601+
sentrySvelteKit({
602+
sourceMapsUploadOptions: {
603+
org: process.env.SENTRY_ORG,
604+
project: process.env.SENTRY_PROJECT,
605+
authToken: process.env.SENTRY_AUTH_TOKEN,
606+
release: '1.0.1',
607+
injectRelease: true,
608+
include: ['./build/*/**/*'],
609+
ignore: ['**/build/client/**/*']
610+
},
611+
}),
612+
613+
// After (v8):
614+
sentrySvelteKit({
615+
sourceMapsUploadOptions: {
616+
org: process.env.SENTRY_ORG,
617+
project: process.env.SENTRY_PROJECT,
618+
authToken: process.env.SENTRY_AUTH_TOKEN,
619+
release: {
620+
name: '1.0.1',
621+
inject: true
622+
},
623+
sourcemaps: {
624+
assets: ['./build/*/**/*'],
625+
ignore: ['**/build/client/**/*'],
626+
filesToDeleteAfterUpload: ['./build/**/*.map']
627+
},
628+
},
629+
}),
630+
```
631+
632+
In the future, we might add additional [options](https://www.npmjs.com/package/@sentry/vite-plugin/v/2.14.2#options)
633+
from the Vite plugin but if you would like to specify some of them directly, you can do this by passing in an
634+
`unstable_sentryVitePluginOptions` object:
635+
636+
```js
637+
sentrySvelteKit({
638+
sourceMapsUploadOptions: {
639+
// ...
640+
release: {
641+
name: '1.0.1',
642+
},
643+
unstable_sentryVitePluginOptions: {
644+
release: {
645+
setCommits: {
646+
auto: true
647+
}
648+
}
649+
}
650+
},
651+
}),
652+
```
653+
654+
Important: we DO NOT guarantee stability of `unstable_sentryVitePluginOptions`. They can be removed or updated at any
655+
time, including breaking changes within the same major version of the SDK.
656+
584657
## 5. Behaviour Changes
585658

586659
- [Updated behaviour of `tracePropagationTargets` in the browser](./MIGRATION.md#updated-behaviour-of-tracepropagationtargets-in-the-browser-http-tracing-headers--cors)
@@ -969,10 +1042,6 @@ instead now.
9691042
Instead, you can get the currently active span via `Sentry.getActiveSpan()`. Setting a span on the scope happens
9701043
automatically when you use the new performance APIs `startSpan()` and `startSpanManual()`.
9711044

972-
## Deprecate `scope.setTransactionName()`
973-
974-
Instead, either set this as attributes or tags, or use an event processor to set `event.transaction`.
975-
9761045
## Deprecate `scope.getTransaction()` and `getActiveTransaction()`
9771046

9781047
Instead, you should not rely on the active transaction, but just use `startSpan()` APIs, which handle this for you.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"main": "index.js",
55
"license": "MIT",
66
"engines": {
7-
"node": ">=14.8"
7+
"node": ">=14.18"
88
},
99
"private": true,
1010
"scripts": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
5+
Sentry.init({
6+
dsn: 'https://[email protected]/1337',
7+
integrations: [
8+
Sentry.browserTracingIntegration({
9+
// To avoid having this test run for 15s
10+
childSpanTimeout: 4000,
11+
}),
12+
],
13+
defaultIntegrations: false,
14+
tracesSampleRate: 1,
15+
});
16+
17+
const activeSpan = Sentry.getActiveSpan();
18+
if (activeSpan) {
19+
Sentry.startInactiveSpan({ name: 'pageload-child-span' });
20+
} else {
21+
setTimeout(() => {
22+
Sentry.startInactiveSpan({ name: 'pageload-child-span' });
23+
}, 200);
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { expect } from '@playwright/test';
2+
3+
import { sentryTest } from '../../../../utils/fixtures';
4+
import {
5+
envelopeRequestParser,
6+
shouldSkipTracingTest,
7+
waitForTransactionRequestOnUrl,
8+
} from '../../../../utils/helpers';
9+
10+
// This tests asserts that the pageload span will finish itself after the child span timeout if it
11+
// has a child span without adding any additional ones or finishing any of them finishing. All of the child spans that
12+
// are still running should have the status "cancelled".
13+
sentryTest('should send a pageload span terminated via child span timeout', async ({ getLocalTestUrl, page }) => {
14+
if (shouldSkipTracingTest()) {
15+
sentryTest.skip();
16+
}
17+
18+
const url = await getLocalTestUrl({ testDir: __dirname });
19+
const req = await waitForTransactionRequestOnUrl(page, url);
20+
21+
const eventData = envelopeRequestParser(req);
22+
23+
expect(eventData.contexts?.trace?.op).toBe('pageload');
24+
expect(eventData.spans?.length).toBeGreaterThanOrEqual(1);
25+
const testSpan = eventData.spans?.find(span => span.description === 'pageload-child-span');
26+
expect(testSpan).toBeDefined();
27+
expect(testSpan?.status).toBe('cancelled');
28+
});

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageloadWithHeartbeatTimeout/init.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageloadWithHeartbeatTimeout/test.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ sentryTest(
2929
expect(eventData.measurements).toBeDefined();
3030
expect(eventData.measurements?.lcp?.value).toBeDefined();
3131

32-
expect(eventData.tags?.['lcp.element']).toBe('body > img');
33-
expect(eventData.tags?.['lcp.size']).toBe(107400);
34-
expect(eventData.tags?.['lcp.url']).toBe('https://example.com/path/to/image.png');
32+
expect(eventData.contexts?.trace?.data?.['lcp.element']).toBe('body > img');
33+
expect(eventData.contexts?.trace?.data?.['lcp.size']).toBe(107400);
34+
expect(eventData.contexts?.trace?.data?.['lcp.url']).toBe('https://example.com/path/to/image.png');
3535

3636
const lcp = await (await page.waitForFunction('window._LCP')).jsonValue();
3737
const lcp2 = await (await page.waitForFunction('window._LCP2')).jsonValue();

dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sentryTest('should capture a "GOOD" CLS vital with its source(s).', async ({ get
2323
expect(eventData.measurements?.cls?.value).toBeGreaterThan(0.03);
2424
expect(eventData.measurements?.cls?.value).toBeLessThan(0.07);
2525

26-
expect(eventData.tags?.['cls.source.1']).toBe('body > div#content > p#partial');
26+
expect(eventData.contexts?.trace?.data?.['cls.source.1']).toBe('body > div#content > p#partial');
2727
});
2828

2929
sentryTest('should capture a "MEH" CLS vital with its source(s).', async ({ getLocalTestPath, page }) => {
@@ -37,7 +37,7 @@ sentryTest('should capture a "MEH" CLS vital with its source(s).', async ({ getL
3737
expect(eventData.measurements?.cls?.value).toBeGreaterThan(0.18);
3838
expect(eventData.measurements?.cls?.value).toBeLessThan(0.23);
3939

40-
expect(eventData.tags?.['cls.source.1']).toBe('body > div#content > p');
40+
expect(eventData.contexts?.trace?.data?.['cls.source.1']).toBe('body > div#content > p');
4141
});
4242

4343
sentryTest('should capture a "POOR" CLS vital with its source(s).', async ({ getLocalTestPath, page }) => {
@@ -50,5 +50,5 @@ sentryTest('should capture a "POOR" CLS vital with its source(s).', async ({ get
5050
// Flakey value dependent on timings -> we check for a range
5151
expect(eventData.measurements?.cls?.value).toBeGreaterThan(0.34);
5252
expect(eventData.measurements?.cls?.value).toBeLessThan(0.36);
53-
expect(eventData.tags?.['cls.source.1']).toBe('body > div#content > p');
53+
expect(eventData.contexts?.trace?.data?.['cls.source.1']).toBe('body > div#content > p');
5454
});

dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ sentryTest('should capture a LCP vital with element details.', async ({ browserN
1010
sentryTest.skip();
1111
}
1212

13-
await page.route('**/path/to/image.png', (route: Route) =>
14-
route.fulfill({ path: `${__dirname}/assets/sentry-logo-600x179.png` }),
15-
);
13+
page.route('**', route => route.continue());
14+
page.route('**/path/to/image.png', async (route: Route) => {
15+
return route.fulfill({ path: `${__dirname}/assets/sentry-logo-600x179.png` });
16+
});
1617

1718
const url = await getLocalTestPath({ testDir: __dirname });
1819
const [eventData] = await Promise.all([
@@ -24,7 +25,7 @@ sentryTest('should capture a LCP vital with element details.', async ({ browserN
2425
expect(eventData.measurements).toBeDefined();
2526
expect(eventData.measurements?.lcp?.value).toBeDefined();
2627

27-
expect(eventData.tags?.['lcp.element']).toBe('body > img');
28-
expect(eventData.tags?.['lcp.size']).toBe(107400);
29-
expect(eventData.tags?.['lcp.url']).toBe('https://example.com/path/to/image.png');
28+
expect(eventData.contexts?.trace?.data?.['lcp.element']).toBe('body > img');
29+
expect(eventData.contexts?.trace?.data?.['lcp.size']).toBe(107400);
30+
expect(eventData.contexts?.trace?.data?.['lcp.url']).toBe('https://example.com/path/to/image.png');
3031
});

dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@sentry/node-experimental": "latest || *",
16+
"@sentry/node": "latest || *",
1617
"@sentry/sveltekit": "latest || *",
1718
"@sentry/remix": "latest || *",
1819
"@sentry/astro": "latest || *",

dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,52 @@
11
import * as SentryAstro from '@sentry/astro';
22
import * as SentryBun from '@sentry/bun';
33
import * as SentryNextJs from '@sentry/nextjs';
4-
import * as SentryNode from '@sentry/node-experimental';
4+
import * as SentryNode from '@sentry/node';
5+
import * as SentryNodeExperimental from '@sentry/node-experimental';
56
import * as SentryRemix from '@sentry/remix';
67
import * as SentryServerless from '@sentry/serverless';
78
import * as SentrySvelteKit from '@sentry/sveltekit';
89

910
/* List of exports that are safe to ignore / we don't require in any depending package */
10-
const NODE_EXPORTS_IGNORE = [
11+
const NODE_EXPERIMENTAL_EXPORTS_IGNORE = [
1112
'default',
1213
// Probably generated by transpilation, no need to require it
1314
'__esModule',
14-
// These Node exports were only made for type definition fixes (see #10339)
15-
'Undici',
15+
// These are not re-exported where not needed
1616
'Http',
17-
'DebugSession',
18-
'AnrIntegrationOptions',
19-
'LocalVariablesIntegrationOptions',
17+
'Undici',
18+
];
19+
20+
/* List of exports that are safe to ignore / we don't require in any depending package */
21+
const NODE_EXPORTS_IGNORE = [
22+
'default',
23+
// Probably generated by transpilation, no need to require it
24+
'__esModule',
2025
];
2126

27+
/* Sanitized list of node exports */
28+
const nodeExperimentalExports = Object.keys(SentryNodeExperimental).filter(
29+
e => !NODE_EXPERIMENTAL_EXPORTS_IGNORE.includes(e),
30+
);
31+
const nodeExports = Object.keys(SentryNode).filter(e => !NODE_EXPORTS_IGNORE.includes(e));
32+
2233
type Dependent = {
2334
package: string;
2435
exports: string[];
2536
ignoreExports?: string[];
2637
skip?: boolean;
38+
compareWith: string[];
2739
};
2840

2941
const DEPENDENTS: Dependent[] = [
3042
{
3143
package: '@sentry/astro',
44+
compareWith: nodeExports,
3245
exports: Object.keys(SentryAstro),
3346
},
3447
{
3548
package: '@sentry/bun',
49+
compareWith: nodeExperimentalExports,
3650
exports: Object.keys(SentryBun),
3751
ignoreExports: [
3852
// not supported in bun:
@@ -44,35 +58,36 @@ const DEPENDENTS: Dependent[] = [
4458
},
4559
{
4660
package: '@sentry/nextjs',
61+
compareWith: nodeExperimentalExports,
4762
// Next.js doesn't require explicit exports, so we can just merge top level and `default` exports:
4863
// @ts-expect-error: `default` is not in the type definition but it's defined
4964
exports: Object.keys({ ...SentryNextJs, ...SentryNextJs.default }),
5065
},
5166
{
5267
package: '@sentry/remix',
68+
compareWith: nodeExperimentalExports,
5369
exports: Object.keys(SentryRemix),
5470
},
5571
{
5672
package: '@sentry/serverless',
73+
compareWith: nodeExperimentalExports,
5774
exports: Object.keys(SentryServerless),
5875
ignoreExports: ['cron', 'hapiErrorPlugin'],
5976
},
6077
{
6178
package: '@sentry/sveltekit',
79+
compareWith: nodeExperimentalExports,
6280
exports: Object.keys(SentrySvelteKit),
6381
},
6482
];
6583

66-
/* Sanitized list of node exports */
67-
const nodeExports = Object.keys(SentryNode).filter(e => !NODE_EXPORTS_IGNORE.includes(e));
68-
6984
console.log('🔎 Checking for consistent exports of @sentry/node exports in depending packages');
7085

7186
const missingExports: Record<string, string[]> = {};
7287
const dependentsToCheck = DEPENDENTS.filter(d => !d.skip);
7388

74-
for (const nodeExport of nodeExports) {
75-
for (const dependent of dependentsToCheck) {
89+
for (const dependent of dependentsToCheck) {
90+
for (const nodeExport of dependent.compareWith) {
7691
if (dependent.ignoreExports?.includes(nodeExport)) {
7792
continue;
7893
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "8.0.0-alpha.2",
44
"license": "MIT",
55
"engines": {
6-
"node": ">=14.8"
6+
"node": ">=14.18"
77
},
88
"private": true,
99
"main": "build/cjs/index.js",

0 commit comments

Comments
 (0)