You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**DISCLAIMER: THIS MIGRATION GUIDE IS WORK IN PROGRESS**
4
4
5
-
Version 9 of the Sentry SDK concerns itself with API cleanup and compatibility updates.
5
+
Version 9 of the Sentry SDK concerns API cleanup and compatibility updates.
6
6
This update contains behavioral changes that will not be caught by TypeScript or linters, so we recommend carefully reading the section on [Behavioral Changes](#2-behavior-changes).
7
7
8
8
Before updating to version `9.x` of the SDK, we recommend upgrading to the latest version of `8.x`.
@@ -14,14 +14,14 @@ Lower versions may continue to work, but may not support all features.
14
14
## 1. Version Support Changes:
15
15
16
16
Version 9 of the Sentry SDK has new compatibility ranges for runtimes and frameworks.
17
-
We periodically update the compatibility ranges in major versions to increase reliability and quality of APIs and instrumentation data.
17
+
We periodically update the compatibility ranges in major versions to increase the reliability and quality of APIs and instrumentation data.
18
18
19
19
### General Runtime Support Changes
20
20
21
-
**ECMAScript Version:** All of the JavaScript code in the Sentry SDK packages may now contain ECMAScript 2020 features.
21
+
**ECMAScript Version:** All the JavaScript code in the Sentry SDK packages may now contain ECMAScript 2020 features.
22
22
This includes features like Nullish Coalescing (`??`), Optional Chaining (`?.`), `String.matchAll()`, Logical Assignment Operators (`&&=`, `||=`, `??=`), and `Promise.allSettled()`.
23
23
24
-
If you observe failures due to syntax or features listed above, it may be an indicator that your current runtime does not support ES2020.
24
+
If you observe failures due to syntax or features listed above, it may indicate that your current runtime does not support ES2020.
25
25
If your runtime does not support ES2020, we recommend transpiling the SDK using Babel or similar tooling.
26
26
27
27
**Node.js:** The minimum supported Node.js version is **18.0.0**, except for ESM-only SDKs (nuxt, solidstart, astro) which require Node **18.19.1** or up.
- When `skipOpenTelemetrySetup: true` is configured, `httpIntegration({ spans: false })` will be configured by default. This means that you no longer have to specify this yourself in this scenario. With this change, no spans are emitted once `skipOpenTelemetrySetup: true` is configured, without any further configuration being needed.
97
+
- When `skipOpenTelemetrySetup: true` is configured, `httpIntegration({ spans: false })` will be configured by default.
98
+
99
+
This means that you no longer have to specify this yourself in this scenario. With this change, no spans are emitted once `skipOpenTelemetrySetup: true` is configured, without any further configuration being needed.
98
100
99
101
- The `requestDataIntegration` will no longer automatically set the user from `request.user`. This is an express-specific, undocumented behavior, and also conflicts with our privacy-by-default strategy. Starting in v9, you'll need to manually call `Sentry.setUser()` e.g. in a middleware to set the user on Sentry events.
100
102
101
103
- The `tracesSampler` hook will no longer be called for _every_ span. Instead, it will only be called for "root spans". Root spans are spans that have no local parent span. Root spans may however have incoming trace data from a different service, for example when using distributed tracing.
102
104
103
105
### `@sentry/browser`
104
106
105
-
- The `captureUserFeedback` method has been removed. Use `captureFeedback` instead and update the `comments` field to `message`.
107
+
- The `captureUserFeedback` method has been removed. Use the `captureFeedback` method instead and update the `comments` field to `message`.
106
108
107
109
### `@sentry/nextjs`
108
110
@@ -130,7 +132,7 @@ TODO
130
132
131
133
## 3. Package Removals
132
134
133
-
As part of an architectural cleanup we deprecated the following packages:
135
+
As part of an architectural cleanup, we deprecated the following packages:
134
136
135
137
-`@sentry/utils`
136
138
-`@sentry/types`
@@ -139,7 +141,7 @@ All of these packages exports and APIs have been moved into the `@sentry/core` p
139
141
140
142
The `@sentry/utils` package will no longer be published.
141
143
142
-
The `@sentry/types` package will continue to be published but it is deprecated and we don't plan on extending its APi.
144
+
The `@sentry/types` package will continue to be published but it is deprecated and we don't plan on extending its API.
143
145
You may experience slight compatibility issues in the future by using it.
144
146
We decided to keep this package around to temporarily lessen the upgrade burden.
145
147
It will be removed in a future major version.
@@ -166,18 +168,17 @@ Sentry.init({
166
168
167
169
- The `DEFAULT_USER_INCLUDES` constant has been removed.
168
170
169
-
### `@sentry/react`
171
+
### `@sentry/browser`
170
172
171
-
- The `wrapUseRoutes` method has been removed. Use `wrapUseRoutesV6` or `wrapUseRoutesV7` instead depending on what version of react router you are using.
172
-
- The `wrapCreateBrowserRouter` method has been removed. Use `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` depending on what version of react router you are using.
173
+
- The `captureUserFeedback` method has been removed. Use the `captureFeedback` method instead and update the `comments` field to `message`.
173
174
174
175
### `@sentry/core`
175
176
176
177
- The `getNumberOfUrlSegments` method has been removed. There is no replacement.
177
178
- The `validSeverityLevels` export has been removed. There is no replacement.
178
179
- The `makeFifoCache` method has been removed. There is no replacement.
179
180
- The `arrayify` export has been removed. There is no replacement.
180
-
- The `BAGGAGE_HEADER_NAME` export has been removed. Use `"baggage"` string constant directly instead.
181
+
- The `BAGGAGE_HEADER_NAME` export has been removed. Use the `"baggage"` string constant directly instead.
181
182
- The `flatten` export has been removed. There is no replacement.
182
183
- The `urlEncode` method has been removed. There is no replacement.
183
184
- The `getDomElement` method has been removed. There is no replacement.
@@ -193,46 +194,48 @@ The following changes are unlikely to affect users of the SDK. They are listed h
193
194
194
195
-`client._prepareEvent()` now requires a currentScope & isolationScope to be passed as last arugments
195
196
196
-
### `@sentry/browser`
197
-
198
-
- The `captureUserFeedback` method has been removed. Use `captureFeedback` instead and update the `comments` field to `message`.
199
-
200
197
### `@sentry/nestjs`
201
198
202
-
- Removed `WithSentry` decorator. Use `SentryExceptionCaptured` instead.
199
+
- Removed `WithSentry` decorator. Use the `SentryExceptionCaptured` decorator instead.
203
200
- Removed `SentryService`.
204
-
If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`.
205
-
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService`afterwards.
201
+
-If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`.
202
+
-If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService`afterward.
206
203
- Removed `SentryTracingInterceptor`.
207
-
If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`.
208
-
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor`afterwards.
204
+
-If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`.
205
+
-If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor`afterward.
209
206
- Removed `SentryGlobalGenericFilter`.
210
-
Use the `SentryGlobalFilter` instead.
211
-
The `SentryGlobalFilter` is a drop-in replacement.
207
+
-Use the `SentryGlobalFilter` instead.
208
+
-The `SentryGlobalFilter` is a drop-in replacement.
212
209
- Removed `SentryGlobalGraphQLFilter`.
213
-
Use the `SentryGlobalFilter` instead.
214
-
The `SentryGlobalFilter` is a drop-in replacement.
210
+
- Use the `SentryGlobalFilter` instead.
211
+
- The `SentryGlobalFilter` is a drop-in replacement.
212
+
213
+
### `@sentry/react`
214
+
215
+
- The `wrapUseRoutes` method has been removed. Use the `wrapUseRoutesV6` or `wrapUseRoutesV7` methods instead depending on what version of react router you are using.
216
+
- The `wrapCreateBrowserRouter` method has been removed. Use the `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` methods depending on what version of react router you are using.
215
217
216
218
## `@sentry/vue`
217
219
218
220
- The options `tracingOptions`, `trackComponents`, `timeout`, `hooks` have been removed everywhere except in the `tracingOptions` option of `vueIntegration()`.
219
-
These options should now be set as follows:
220
-
221
-
```ts
222
-
import*asSentryfrom'@sentry/vue';
223
-
224
-
Sentry.init({
225
-
integrations: [
226
-
Sentry.vueIntegration({
227
-
tracingOptions: {
228
-
trackComponents: true,
229
-
timeout: 1000,
230
-
hooks: ['mount', 'update', 'unmount'],
231
-
},
232
-
}),
233
-
],
234
-
});
235
-
```
221
+
222
+
These options should now be set as follows:
223
+
224
+
```js
225
+
import*asSentryfrom'@sentry/vue';
226
+
227
+
Sentry.init({
228
+
integrations: [
229
+
Sentry.vueIntegration({
230
+
tracingOptions: {
231
+
trackComponents:true,
232
+
timeout:1000,
233
+
hooks: ['mount', 'update', 'unmount'],
234
+
},
235
+
}),
236
+
],
237
+
});
238
+
```
236
239
237
240
- The option `logErrors` in the `vueIntegration` has been removed. The Sentry Vue error handler will propagate the error to a user-defined error handler
238
241
or just re-throw the error (which will log the error without modifying).
@@ -250,13 +253,25 @@ Let us know if this is causing issues in your setup by opening an issue on GitHu
250
253
251
254
### `@sentry/deno`
252
255
253
-
- The import of Sentry from the deno registry has changed. Use `import * as Sentry from 'https://deno.land/x/sentry/build/index.mjs'` instead.
256
+
- The import of Sentry from the deno registry has changed. Use the `import * as Sentry from 'https://deno.land/x/sentry/build/index.mjs'` import instead.
In v8, types have been exported from `@sentry/types`, while implementations have been exported from other classes.
269
+
258
270
This led to some duplication, where we had to keep an interface in `@sentry/types`, while the implementation mirroring that interface was kept e.g. in `@sentry/core`.
259
-
Since v9, the types have been merged into `@sentry/core`, which removed some of this duplication. This means that certain things that used to be a separate interface, will not expect an actual instance of the class/concrete implementation. This should not affect most users, unless you relied on passing things with a similar shape to internal methods. The following types are affected:
271
+
272
+
Since v9, the types have been merged into `@sentry/core`, which removed some of this duplication. This means that certain things that used to be a separate interface, will not expect an actual instance of the class/concrete implementation.
273
+
274
+
This should not affect most users unless you relied on passing things with a similar shape to internal methods. The following types are affected:
260
275
261
276
-`Scope` now always expects the `Scope` class
262
277
- The `TransactionNamingScheme` type has been removed. There is no replacement.
@@ -272,6 +287,7 @@ Since v9, the types have been merged into `@sentry/core`, which removed some of
272
287
273
288
Version support timelines are stressful for anybody using the SDK, so we won't be defining one.
274
289
Instead, we will be applying bug fixes and features to older versions as long as there is demand for them.
290
+
275
291
We also hold ourselves to high standards security-wise, meaning that if any vulnerabilities are found, we will in almost all cases backport them.
276
292
277
293
Note, that we will decide on a case-per-case basis, what gets backported or not.
@@ -290,22 +306,23 @@ The following outlines deprecations that were introduced in version 8 of the SDK
290
306
291
307
-**Passing `undefined` to `tracesSampleRate` / `tracesSampler` / `enableTracing` will be handled differently in v9**
292
308
293
-
In v8, a setup like the following:
309
+
In v8, explicitly setting `tracesSampleRate` (even if it is set to `undefined`) will result in tracing being _enabled_, although no spans will be generated.
310
+
311
+
```ts
312
+
Sentry.init({
313
+
tracesSampleRate: undefined,
314
+
});
315
+
```
294
316
295
-
```ts
296
-
Sentry.init({
297
-
tracesSampleRate: undefined,
298
-
});
299
-
```
317
+
In v9, we will streamline this behavior so that passing `undefined` will result in tracing being disabled, the same as not passing the option at all.
300
318
301
-
Will result in tracing being _enabled_, although no spans will be generated.
302
-
In v9, we will streamline this behavior so that passing `undefined` will result in tracing being disabled, the same as not passing the option at all.
303
-
If you are relying on `undefined` being passed in and having tracing enabled because of this, you should update your config to set e.g. `tracesSampleRate: 0` instead, which will also enable tracing in v9.
319
+
If you are relying on `undefined` being passed in and having tracing enabled because of this, you should update your config to set e.g. `tracesSampleRate: 0` instead, which will also enable tracing in v9.
304
320
305
321
-**The `autoSessionTracking` option is deprecated.**
306
322
307
-
To enable session tracking, it is recommended to unset `autoSessionTracking` and ensure that either, in browser environments the `browserSessionIntegration` is added, or in server environments the `httpIntegration` is added.
308
-
To disable session tracking, it is recommended unset `autoSessionTracking` and to remove the `browserSessionIntegration` in browser environments, or in server environments configure the `httpIntegration` with the `trackIncomingRequestsAsSessions` option set to `false`.
323
+
To enable session tracking, it is recommended to unset `autoSessionTracking` and ensure that either, in browser environments the `browserSessionIntegration` is added, or in server environments the `httpIntegration` is added.
324
+
325
+
To disable session tracking, it is recommended unset `autoSessionTracking` and to remove the `browserSessionIntegration` in browser environments, or in server environments configure the `httpIntegration` with the `trackIncomingRequestsAsSessions` option set to `false`.
309
326
310
327
-**The metrics API has been removed from the SDK.**
311
328
@@ -315,8 +332,7 @@ The Sentry metrics beta has ended and the metrics API has been removed from the
315
332
316
333
-**The `@sentry/utils` package has been deprecated. Import everything from `@sentry/core` instead.**
317
334
318
-
- Deprecated `AddRequestDataToEventOptions.transaction`. This option effectively doesn't do anything anymore, and will
319
-
be removed in v9.
335
+
- Deprecated `AddRequestDataToEventOptions.transaction`. This option effectively doesn't do anything anymore, and will be removed in v9.
320
336
- Deprecated `TransactionNamingScheme` type.
321
337
- Deprecated `validSeverityLevels`. Will not be replaced.
322
338
- Deprecated `urlEncode`. No replacements.
@@ -325,7 +341,7 @@ The Sentry metrics beta has ended and the metrics API has been removed from the
325
341
- Deprecated `arrayify`. No replacements.
326
342
- Deprecated `memoBuilder`. No replacements.
327
343
- Deprecated `getNumberOfUrlSegments`. No replacements.
328
-
- Deprecated `BAGGAGE_HEADER_NAME`. Use `"baggage"` string constant directly instead.
344
+
- Deprecated `BAGGAGE_HEADER_NAME`. Use the `"baggage"` string constant directly instead.
329
345
- Deprecated `makeFifoCache`. No replacements.
330
346
- Deprecated `dynamicRequire`. No replacements.
331
347
- Deprecated `flatten`. No replacements.
@@ -347,13 +363,13 @@ The Sentry metrics beta has ended and the metrics API has been removed from the
347
363
348
364
## `@sentry/nestjs`
349
365
350
-
- Deprecated `@WithSentry`. Use `@SentryExceptionCaptured` instead.
351
-
- Deprecated `SentryTracingInterceptor`.
366
+
- Deprecated the `@WithSentry` decorator. Use the `@SentryExceptionCaptured` decorator instead.
367
+
- Deprecated the `SentryTracingInterceptor` method.
352
368
If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`.
353
-
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor`afterwards.
369
+
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor`afterward.
354
370
- Deprecated `SentryService`.
355
371
If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`.
356
-
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService`afterwards.
372
+
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService`afterward.
357
373
- Deprecated `SentryGlobalGenericFilter`.
358
374
Use the `SentryGlobalFilter` instead.
359
375
The `SentryGlobalFilter` is a drop-in replacement.
@@ -377,48 +393,50 @@ The Sentry metrics beta has ended and the metrics API has been removed from the
377
393
## `@sentry/vue`
378
394
379
395
- Deprecated `tracingOptions`, `trackComponents`, `timeout`, `hooks` options everywhere other than in the `tracingOptions` option of the `vueIntegration()`.
380
-
These options should now be set as follows:
381
-
382
-
```ts
383
-
import*asSentryfrom'@sentry/vue';
384
-
385
-
Sentry.init({
386
-
integrations: [
387
-
Sentry.vueIntegration({
388
-
tracingOptions: {
389
-
trackComponents: true,
390
-
timeout: 1000,
391
-
hooks: ['mount', 'update', 'unmount'],
392
-
},
393
-
}),
394
-
],
395
-
});
396
-
```
396
+
397
+
These options should now be set as follows:
398
+
399
+
```ts
400
+
import*asSentryfrom'@sentry/vue';
401
+
402
+
Sentry.init({
403
+
integrations: [
404
+
Sentry.vueIntegration({
405
+
tracingOptions: {
406
+
trackComponents: true,
407
+
timeout: 1000,
408
+
hooks: ['mount', 'update', 'unmount'],
409
+
},
410
+
}),
411
+
],
412
+
});
413
+
```
397
414
398
415
- Deprecated `logErrors` in the `vueIntegration`. The Sentry Vue error handler will propagate the error to a user-defined error handler
399
416
or just re-throw the error (which will log the error without modifying).
400
417
401
418
## `@sentry/nuxt` and `@sentry/vue`
402
419
403
420
- When component tracking is enabled, "update" spans are no longer created by default.
404
-
Add an `"update"` item to the `tracingOptions.hooks` option via the `vueIntegration()` to restore this behavior.
405
-
406
-
```ts
407
-
Sentry.init({
408
-
integrations: [
409
-
Sentry.vueIntegration({
410
-
tracingOptions: {
411
-
trackComponents: true,
412
-
hooks: [
413
-
'mount',
414
-
'update', // <--
415
-
'unmount',
416
-
],
417
-
},
418
-
}),
419
-
],
420
-
});
421
-
```
421
+
422
+
Add an `"update"` item to the `tracingOptions.hooks` option via the `vueIntegration()` to restore this behavior.
423
+
424
+
```ts
425
+
Sentry.init({
426
+
integrations: [
427
+
Sentry.vueIntegration({
428
+
tracingOptions: {
429
+
trackComponents: true,
430
+
hooks: [
431
+
'mount',
432
+
'update', // <--
433
+
'unmount',
434
+
],
435
+
},
436
+
}),
437
+
],
438
+
});
439
+
```
422
440
423
441
## `@sentry/astro`
424
442
@@ -430,16 +448,16 @@ The Sentry metrics beta has ended and the metrics API has been removed from the
430
448
431
449
## `@sentry/react`
432
450
433
-
- Deprecated `wrapUseRoutes`. Use `wrapUseRoutesV6` or `wrapUseRoutesV7` instead.
434
-
- Deprecated `wrapCreateBrowserRouter`. Use `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` instead.
451
+
- Deprecated `wrapUseRoutes`. Use the `wrapUseRoutesV6` or `wrapUseRoutesV7` methods instead.
452
+
- Deprecated `wrapCreateBrowserRouter`. Use the `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` methods instead.
435
453
436
454
## `@sentry/nextjs`
437
455
438
-
- Deprecated `hideSourceMaps`. No replacements. The SDK emits hidden sourcemaps by default.
456
+
- Deprecated the `hideSourceMaps` option. There are no replacements for this option. The SDK emits hidden sourcemaps by default.
439
457
440
458
## `@sentry/opentelemetry`
441
459
442
-
- Deprecated `generateSpanContextForPropagationContext`in favor of doing this manually - we do not need this export anymore.
460
+
- Deprecated the `generateSpanContextForPropagationContext`method. There are no replacements for this method.
443
461
444
462
## Server-side SDKs (`@sentry/node` and all dependents)
0 commit comments