Skip to content

Commit 98eee17

Browse files
authored
Merge branch 'develop' into onur/fix-flaky-remix-e2e-tests
2 parents 8cc732d + 9f0ac34 commit 98eee17

File tree

135 files changed

+1053
-1521
lines changed

Some content is hidden

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

135 files changed

+1053
-1521
lines changed

MIGRATION.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Upgrading from 7.x to 8.x
22

3+
## Removal of deprecated API in `@sentry/nextjs`
4+
5+
The following previously deprecated API has been removed from the `@sentry/nextjs` package:
6+
7+
- `withSentryApi` (Replacement: `wrapApiHandlerWithSentry`)
8+
- `withSentryAPI` (Replacement: `wrapApiHandlerWithSentry`)
9+
- `withSentryGetServerSideProps` (Replacement: `wrapGetServerSidePropsWithSentry`)
10+
- `withSentryGetStaticProps` (Replacement: `wrapGetStaticPropsWithSentry`)
11+
- `withSentryServerSideGetInitialProps` (Replacement: `wrapGetInitialPropsWithSentry`)
12+
- `withSentryServerSideAppGetInitialProps` (Replacement: `wrapAppGetInitialPropsWithSentry`)
13+
- `withSentryServerSideDocumentGetInitialProps` (Replacement: `wrapDocumentGetInitialPropsWithSentry`)
14+
- `withSentryServerSideErrorGetInitialProps` was renamed to `wrapErrorGetInitialPropsWithSentry`
15+
- `nextRouterInstrumentation` (Replaced by using `browserTracingIntegration`)
16+
- `IS_BUILD`
17+
- `isBuild`
18+
319
## Removal of Severity Enum
420

521
In v7 we deprecated the `Severity` enum in favor of using the `SeverityLevel` type. In v8 we removed the `Severity`
@@ -11,6 +27,12 @@ enum. If you were using the `Severity` enum, you should replace it with the `Sev
1127
The `Offline` integration has been removed in favor of the offline transport wrapper:
1228
http://docs.sentry.io/platforms/javascript/configuration/transports/#offline-caching
1329

30+
## Removal of `enableAnrDetection` and `Anr` class (##10562)
31+
32+
The `enableAnrDetection` and `Anr` class have been removed. See the
33+
[docs](https://docs.sentry.io/platforms/node/configuration/application-not-responding/) for more details how to migrate
34+
to `anrIntegration`, the new integration for ANR detection.
35+
1436
## Other changes
1537

1638
- Remove `spanStatusfromHttpCode` in favour of `getSpanStatusFromHttpCode` (#10361)
@@ -289,6 +311,45 @@ If you are using the `Hub` right now, see the following table on how to migrate
289311
| endSession() | `Sentry.endSession()` |
290312
| shouldSendDefaultPii() | REMOVED - The closest equivalent is `Sentry.getClient().getOptions().sendDefaultPii` |
291313

314+
The `Hub` constructor is also deprecated and will be removed in the next major version. If you are creating Hubs for
315+
multi-client use like so:
316+
317+
```ts
318+
// OLD
319+
const hub = new Hub();
320+
hub.bindClient(client);
321+
makeMain(hub);
322+
```
323+
324+
instead initialize the client as follows:
325+
326+
```ts
327+
// NEW
328+
Sentry.withIsolationScope(() => {
329+
Sentry.setCurrentClient(client);
330+
client.init();
331+
});
332+
```
333+
334+
If you are using the Hub to capture events like so:
335+
336+
```ts
337+
// OLD
338+
const client = new Client();
339+
const hub = new Hub(client);
340+
hub.captureException();
341+
```
342+
343+
instead capture isolated events as follows:
344+
345+
```ts
346+
// NEW
347+
const client = new Client();
348+
const scope = new Scope();
349+
scope.setClient(client);
350+
scope.captureException();
351+
```
352+
292353
## Deprecate `client.setupIntegrations()`
293354

294355
Instead, use the new `client.init()` method. You should probably not use this directly and instead use `Sentry.init()`,

dev-packages/browser-integration-tests/suites/replay/dsc/test.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ sentryTest(
3636

3737
await page.evaluate(() => {
3838
const scope = (window as unknown as TestWindow).Sentry.getCurrentScope();
39-
scope.setUser({ id: 'user123', segment: 'segmentB' });
39+
scope.setUser({ id: 'user123' });
4040
scope.addEventProcessor(event => {
4141
event.transaction = 'testTransactionDSC';
4242
return event;
@@ -53,7 +53,6 @@ sentryTest(
5353
expect(envHeader.trace).toBeDefined();
5454
expect(envHeader.trace).toEqual({
5555
environment: 'production',
56-
user_segment: 'segmentB',
5756
sample_rate: '1',
5857
trace_id: expect.any(String),
5958
public_key: 'public',
@@ -84,7 +83,7 @@ sentryTest(
8483

8584
await page.evaluate(() => {
8685
const scope = (window as unknown as TestWindow).Sentry.getCurrentScope();
87-
scope.setUser({ id: 'user123', segment: 'segmentB' });
86+
scope.setUser({ id: 'user123' });
8887
scope.addEventProcessor(event => {
8988
event.transaction = 'testTransactionDSC';
9089
return event;
@@ -101,7 +100,6 @@ sentryTest(
101100
expect(envHeader.trace).toBeDefined();
102101
expect(envHeader.trace).toEqual({
103102
environment: 'production',
104-
user_segment: 'segmentB',
105103
sample_rate: '1',
106104
trace_id: expect.any(String),
107105
public_key: 'public',
@@ -144,7 +142,7 @@ sentryTest(
144142

145143
await page.evaluate(() => {
146144
const scope = (window as unknown as TestWindow).Sentry.getCurrentScope();
147-
scope.setUser({ id: 'user123', segment: 'segmentB' });
145+
scope.setUser({ id: 'user123' });
148146
scope.addEventProcessor(event => {
149147
event.transaction = 'testTransactionDSC';
150148
return event;
@@ -162,7 +160,6 @@ sentryTest(
162160
expect(envHeader.trace).toBeDefined();
163161
expect(envHeader.trace).toEqual({
164162
environment: 'production',
165-
user_segment: 'segmentB',
166163
sample_rate: '1',
167164
trace_id: expect.any(String),
168165
public_key: 'public',
@@ -195,7 +192,7 @@ sentryTest(
195192

196193
await page.evaluate(async () => {
197194
const scope = (window as unknown as TestWindow).Sentry.getCurrentScope();
198-
scope.setUser({ id: 'user123', segment: 'segmentB' });
195+
scope.setUser({ id: 'user123' });
199196
scope.addEventProcessor(event => {
200197
event.transaction = 'testTransactionDSC';
201198
return event;
@@ -213,7 +210,6 @@ sentryTest(
213210
expect(envHeader.trace).toBeDefined();
214211
expect(envHeader.trace).toEqual({
215212
environment: 'production',
216-
user_segment: 'segmentB',
217213
sample_rate: '1',
218214
trace_id: expect.any(String),
219215
public_key: 'public',

dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Sentry.init({
1212
});
1313

1414
const scope = Sentry.getCurrentScope();
15-
scope.setUser({ id: 'user123', segment: 'segmentB' });
15+
scope.setUser({ id: 'user123' });
1616
scope.addEventProcessor(event => {
1717
event.transaction = 'testTransactionDSC';
1818
return event;

dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ sentryTest(
2222
expect(envHeader.trace).toBeDefined();
2323
expect(envHeader.trace).toEqual({
2424
environment: 'production',
25-
user_segment: 'segmentB',
2625
sample_rate: '1',
2726
transaction: expect.stringContaining('/index.html'),
2827
trace_id: expect.any(String),

dev-packages/browser-integration-tests/suites/tracing/envelope-header/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Sentry.init({
1212
});
1313

1414
const scope = Sentry.getCurrentScope();
15-
scope.setUser({ id: 'user123', segment: 'segmentB' });
15+
scope.setUser({ id: 'user123' });
1616
scope.addEventProcessor(event => {
1717
event.transaction = 'testTransactionDSC';
1818
return event;

dev-packages/browser-integration-tests/suites/tracing/envelope-header/test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ sentryTest(
2626
expect(envHeader.trace).toBeDefined();
2727
expect(envHeader.trace).toEqual({
2828
environment: 'production',
29-
user_segment: 'segmentB',
3029
sample_rate: '1',
3130
trace_id: expect.any(String),
3231
public_key: 'public',

dev-packages/e2e-tests/test-applications/create-next-app/pages/api/success.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,7 @@ import * as Sentry from '@sentry/nextjs';
33
import type { NextApiRequest, NextApiResponse } from 'next';
44

55
export default function handler(req: NextApiRequest, res: NextApiResponse) {
6-
// eslint-disable-next-line deprecation/deprecation
7-
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
8-
// eslint-disable-next-line deprecation/deprecation
9-
Sentry.getCurrentScope().setSpan(transaction);
10-
11-
// eslint-disable-next-line deprecation/deprecation
12-
const span = transaction.startChild();
13-
14-
span.end();
15-
transaction.end();
6+
Sentry.startSpan({ name: 'test-span' }, span => undefined);
167

178
Sentry.flush().then(() => {
189
res.status(200).json({

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const DEPENDENTS: Dependent[] = [
6060
{
6161
package: '@sentry/serverless',
6262
exports: Object.keys(SentryServerless),
63-
ignoreExports: ['cron', 'hapiErrorPlugin', 'enableAnrDetection'],
63+
ignoreExports: ['cron', 'hapiErrorPlugin'],
6464
},
6565
{
6666
package: '@sentry/sveltekit',

dev-packages/node-integration-tests/suites/anr/basic-session.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Sentry.init({
1111
dsn: 'https://public@dsn.ingest.sentry.io/1337',
1212
release: '1.0',
1313
debug: true,
14-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
14+
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1515
});
1616

1717
function longWork() {

dev-packages/node-integration-tests/suites/anr/basic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Sentry.init({
1212
release: '1.0',
1313
debug: true,
1414
autoSessionTracking: false,
15-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
15+
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1616
});
1717

1818
function longWork() {

dev-packages/node-integration-tests/suites/anr/basic.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Sentry.init({
1212
release: '1.0',
1313
debug: true,
1414
autoSessionTracking: false,
15-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
15+
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1616
});
1717

1818
function longWork() {

dev-packages/node-integration-tests/suites/anr/forked.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Sentry.init({
1212
release: '1.0',
1313
debug: true,
1414
autoSessionTracking: false,
15-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
15+
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1616
});
1717

1818
function longWork() {

dev-packages/node-integration-tests/suites/anr/legacy.js

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

dev-packages/node-integration-tests/suites/anr/should-exit-forced.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function configureSentry() {
66
release: '1.0',
77
debug: true,
88
autoSessionTracking: false,
9-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true })],
9+
integrations: [Sentry.anrIntegration({ captureStackTrace: true })],
1010
});
1111
}
1212

dev-packages/node-integration-tests/suites/anr/should-exit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function configureSentry() {
66
release: '1.0',
77
debug: true,
88
autoSessionTracking: false,
9-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true })],
9+
integrations: [Sentry.anrIntegration({ captureStackTrace: true })],
1010
});
1111
}
1212

dev-packages/node-integration-tests/suites/anr/test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ conditionalTest({ min: 16 })('should report ANR when event loop blocked', () =>
5656
cleanupChildProcesses();
5757
});
5858

59-
// TODO (v8): Remove this old API and this test
60-
test('Legacy API', done => {
61-
createRunner(__dirname, 'legacy.js').expect({ event: EXPECTED_ANR_EVENT }).start(done);
62-
});
63-
6459
test('CJS', done => {
6560
createRunner(__dirname, 'basic.js').expect({ event: EXPECTED_ANR_EVENT }).start(done);
6661
});

dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-out/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Sentry.init({
2020
transport: loggingTransport,
2121
});
2222

23-
Sentry.setUser({ id: 'user123', segment: 'SegmentA' });
23+
Sentry.setUser({ id: 'user123' });
2424

2525
app.use(Sentry.Handlers.requestHandler());
2626
app.use(Sentry.Handlers.tracingHandler());

dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-out/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test('should attach a baggage header to an outgoing request.', async () => {
1515
test_data: {
1616
host: 'somewhere.not.sentry',
1717
baggage:
18-
'sentry-environment=prod,sentry-release=1.0,sentry-user_segment=SegmentA,sentry-public_key=public' +
18+
'sentry-environment=prod,sentry-release=1.0,sentry-public_key=public' +
1919
',sentry-trace_id=86f39e84263a4de99c326acab3bfe3bd,sentry-sample_rate=1,sentry-transaction=GET%20%2Ftest%2Fexpress' +
2020
',sentry-sampled=true',
2121
},

dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-transaction-name/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Sentry.init({
2424
transport: loggingTransport,
2525
});
2626

27-
Sentry.setUser({ id: 'user123', segment: 'SegmentA' });
27+
Sentry.setUser({ id: 'user123' });
2828

2929
app.use(Sentry.Handlers.requestHandler());
3030
app.use(Sentry.Handlers.tracingHandler());

packages/angular-ivy/scripts/prepack.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type PackageJson = {
66
type?: string;
77
nx?: string;
88
volta?: any;
9+
exports?: Record<string, string | Record<string, string>>;
910
};
1011

1112
const buildDir = path.join(process.cwd(), 'build');
@@ -18,6 +19,18 @@ const pkgJson: PackageJson = JSON.parse(fs.readFileSync(pkjJsonPath).toString())
1819
delete pkgJson.main;
1920
pkgJson.type = 'module';
2021

22+
pkgJson.exports = {
23+
'.': {
24+
es2015: './fesm2015/sentry-angular-ivy.js',
25+
esm2015: './esm2015/sentry-angular-ivy.js',
26+
fesm2015: './fesm2015/sentry-angular-ivy.js',
27+
import: './fesm2015/sentry-angular-ivy.js',
28+
require: './bundles/sentry-angular-ivy.umd.js',
29+
types: './sentry-angular-ivy.d.ts',
30+
},
31+
'./*': './*',
32+
};
33+
2134
// no need to keep around other properties that are only relevant for our reop:
2235
delete pkgJson.nx;
2336
delete pkgJson.volta;

packages/astro/src/index.server.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ export {
5858
defaultIntegrations,
5959
getDefaultIntegrations,
6060
defaultStackParser,
61-
// eslint-disable-next-line deprecation/deprecation
62-
lastEventId,
6361
flush,
6462
close,
6563
getSentryRelease,

packages/astro/src/index.types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,4 @@ export declare const defaultStackParser: StackParser;
2626
export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
2727
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;
2828

29-
/**
30-
* @deprecated This function will be removed in the next major version of the Sentry SDK.
31-
*/
32-
export declare function lastEventId(): string | undefined;
33-
3429
export default sentryAstro;

packages/astro/src/server/meta.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function getTracingMetaTags(
4242
: dsc
4343
? dsc
4444
: client
45-
? getDynamicSamplingContextFromClient(traceId, client, scope)
45+
? getDynamicSamplingContextFromClient(traceId, client)
4646
: undefined;
4747

4848
const baggage = dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext);

packages/browser/src/exports.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ export {
4242
getCurrentScope,
4343
Hub,
4444
// eslint-disable-next-line deprecation/deprecation
45-
lastEventId,
46-
// eslint-disable-next-line deprecation/deprecation
4745
// eslint-disable-next-line deprecation/deprecation
4846
makeMain,
4947
setCurrentClient,

0 commit comments

Comments
 (0)