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.
@@ -80,19 +80,21 @@ In v9, an `undefined` value will be treated the same as if the value is not defi
80
80
81
81
### `@sentry/node`
82
82
83
-
- 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.
83
+
- When `skipOpenTelemetrySetup: true` is configured, `httpIntegration({ spans: false })` will be configured by default.
84
+
85
+
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.
84
86
85
87
### `@sentry/browser`
86
88
87
-
- The `captureUserFeedback` method has been removed. Use `captureFeedback` instead and update the `comments` field to `message`.
89
+
- The `captureUserFeedback` method has been removed. Use the `captureFeedback` method instead and update the `comments` field to `message`.
88
90
89
91
### Uncategorized (TODO)
90
92
91
93
TODO
92
94
93
95
## 3. Package Removals
94
96
95
-
As part of an architectural cleanup we deprecated the following packages:
97
+
As part of an architectural cleanup, we deprecated the following packages:
96
98
97
99
-`@sentry/utils`
98
100
-`@sentry/types`
@@ -101,7 +103,7 @@ All of these packages exports and APIs have been moved into the `@sentry/core` p
101
103
102
104
The `@sentry/utils` package will no longer be published.
103
105
104
-
The `@sentry/types` package will continue to be published but it is deprecated and we don't plan on extending its APi.
106
+
The `@sentry/types` package will continue to be published but it is deprecated and we don't plan on extending its API.
105
107
You may experience slight compatibility issues in the future by using it.
106
108
We decided to keep this package around to temporarily lessen the upgrade burden.
107
109
It will be removed in a future major version.
@@ -126,65 +128,66 @@ Sentry.init({
126
128
});
127
129
```
128
130
129
-
### `@sentry/react`
131
+
### `@sentry/browser`
130
132
131
-
- The `wrapUseRoutes` method has been removed. Use `wrapUseRoutesV6` or `wrapUseRoutesV7` instead depending on what version of react router you are using.
132
-
- The `wrapCreateBrowserRouter` method has been removed. Use `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` depending on what version of react router you are using.
133
+
- The `captureUserFeedback` method has been removed. Use the `captureFeedback` method instead and update the `comments` field to `message`.
133
134
134
135
### `@sentry/core`
135
136
136
137
- The `getNumberOfUrlSegments` method has been removed. There is no replacement.
137
138
- The `validSeverityLevels` export has been removed. There is no replacement.
138
139
- The `makeFifoCache` method has been removed. There is no replacement.
139
140
- The `arrayify` export has been removed. There is no replacement.
140
-
- The `BAGGAGE_HEADER_NAME` export has been removed. Use `"baggage"` string constant directly instead.
141
+
- The `BAGGAGE_HEADER_NAME` export has been removed. Use the `"baggage"` string constant directly instead.
141
142
- The `flatten` export has been removed. There is no replacement.
142
143
- The `urlEncode` method has been removed. There is no replacement.
143
144
- The `getDomElement` method has been removed. There is no replacement.
144
145
- The `Request` type has been removed. Use `RequestEventData` type instead.
145
146
- The `TransactionNamingScheme` type has been removed. There is no replacement.
146
147
- The `memoBuilder` method has been removed. There is no replacement.
147
148
148
-
### `@sentry/browser`
149
-
150
-
- The `captureUserFeedback` method has been removed. Use `captureFeedback` instead and update the `comments` field to `message`.
151
-
152
149
### `@sentry/nestjs`
153
150
154
-
- Removed `WithSentry` decorator. Use `SentryExceptionCaptured` instead.
151
+
- Removed `WithSentry` decorator. Use the `SentryExceptionCaptured` decorator instead.
155
152
- Removed `SentryService`.
156
-
If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`.
157
-
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService`afterwards.
153
+
-If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`.
154
+
-If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService`afterward.
158
155
- Removed `SentryTracingInterceptor`.
159
-
If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`.
160
-
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor`afterwards.
156
+
-If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`.
157
+
-If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor`afterward.
161
158
- Removed `SentryGlobalGenericFilter`.
162
-
Use the `SentryGlobalFilter` instead.
163
-
The `SentryGlobalFilter` is a drop-in replacement.
159
+
-Use the `SentryGlobalFilter` instead.
160
+
-The `SentryGlobalFilter` is a drop-in replacement.
164
161
- Removed `SentryGlobalGraphQLFilter`.
165
-
Use the `SentryGlobalFilter` instead.
166
-
The `SentryGlobalFilter` is a drop-in replacement.
162
+
- Use the `SentryGlobalFilter` instead.
163
+
- The `SentryGlobalFilter` is a drop-in replacement.
164
+
165
+
### `@sentry/react`
166
+
167
+
- The `wrapUseRoutes` method has been removed. Use the `wrapUseRoutesV6` or `wrapUseRoutesV7` methods instead depending on what version of react router you are using.
168
+
- The `wrapCreateBrowserRouter` method has been removed. Use the `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` methods depending on what version of react router you are using.
167
169
168
170
## `@sentry/vue`
169
171
170
172
- The options `tracingOptions`, `trackComponents`, `timeout`, `hooks` have been removed everywhere except in the `tracingOptions` option of `vueIntegration()`.
171
-
These options should now be set as follows:
172
-
173
-
```ts
174
-
import*asSentryfrom'@sentry/vue';
175
-
176
-
Sentry.init({
177
-
integrations: [
178
-
Sentry.vueIntegration({
179
-
tracingOptions: {
180
-
trackComponents: true,
181
-
timeout: 1000,
182
-
hooks: ['mount', 'update', 'unmount'],
183
-
},
184
-
}),
185
-
],
186
-
});
187
-
```
173
+
174
+
These options should now be set as follows:
175
+
176
+
```js
177
+
import*asSentryfrom'@sentry/vue';
178
+
179
+
Sentry.init({
180
+
integrations: [
181
+
Sentry.vueIntegration({
182
+
tracingOptions: {
183
+
trackComponents:true,
184
+
timeout:1000,
185
+
hooks: ['mount', 'update', 'unmount'],
186
+
},
187
+
}),
188
+
],
189
+
});
190
+
```
188
191
189
192
## 5. Build Changes
190
193
@@ -199,20 +202,33 @@ Let us know if this is causing issues in your setup by opening an issue on GitHu
199
202
200
203
### `@sentry/deno`
201
204
202
-
- The import of Sentry from the deno registry has changed. Use `import * as Sentry from 'https://deno.land/x/sentry/build/index.mjs'` instead.
205
+
- 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.
218
+
207
219
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`.
208
-
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:
220
+
221
+
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.
222
+
223
+
This should not affect most users unless you relied on passing things with a similar shape to internal methods. The following types are affected:
209
224
210
225
-`Scope` now always expects the `Scope` class
211
226
212
227
# No Version Support Timeline
213
228
214
229
Version support timelines are stressful for anybody using the SDK, so we won't be defining one.
215
230
Instead, we will be applying bug fixes and features to older versions as long as there is demand for them.
231
+
216
232
We also hold ourselves to high standards security-wise, meaning that if any vulnerabilities are found, we will in almost all cases backport them.
217
233
218
234
Note, that we will decide on a case-per-case basis, what gets backported or not.
@@ -227,22 +243,23 @@ The following outlines deprecations that were introduced in version 8 of the SDK
227
243
-**Returning `null` from `beforeSendSpan` span is deprecated.**
228
244
-**Passing `undefined` to `tracesSampleRate` / `tracesSampler` / `enableTracing` will be handled differently in v9**
229
245
230
-
In v8, a setup like the following:
246
+
In v8, explicitly setting `tracesSampleRate` (even if it is set to `undefined`) will result in tracing being _enabled_, although no spans will be generated.
247
+
248
+
```ts
249
+
Sentry.init({
250
+
tracesSampleRate: undefined,
251
+
});
252
+
```
231
253
232
-
```ts
233
-
Sentry.init({
234
-
tracesSampleRate: undefined,
235
-
});
236
-
```
254
+
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.
237
255
238
-
Will result in tracing being _enabled_, although no spans will be generated.
239
-
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.
240
-
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.
256
+
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.
241
257
242
258
-**The `autoSessionTracking` option is deprecated.**
243
259
244
-
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.
245
-
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`.
260
+
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.
261
+
262
+
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`.
246
263
247
264
-**The metrics API has been removed from the SDK.**
248
265
@@ -252,17 +269,16 @@ The Sentry metrics beta has ended and the metrics API has been removed from the
252
269
253
270
-**The `@sentry/utils` package has been deprecated. Import everything from `@sentry/core` instead.**
254
271
255
-
- Deprecated `AddRequestDataToEventOptions.transaction`. This option effectively doesn't do anything anymore, and will
256
-
be removed in v9.
272
+
- Deprecated `AddRequestDataToEventOptions.transaction`. This option effectively doesn't do anything anymore, and will be removed in v9.
257
273
- Deprecated `TransactionNamingScheme` type.
258
274
- Deprecated `validSeverityLevels`. Will not be replaced.
259
275
- Deprecated `urlEncode`. No replacements.
260
-
- Deprecated `addRequestDataToEvent`. Use `addNormalizedRequestDataToEvent` instead.
276
+
- Deprecated `addRequestDataToEvent`. Use the `addNormalizedRequestDataToEvent` method instead.
261
277
- Deprecated `extractRequestData`. Instead manually extract relevant data off request.
262
278
- Deprecated `arrayify`. No replacements.
263
279
- Deprecated `memoBuilder`. No replacements.
264
280
- Deprecated `getNumberOfUrlSegments`. No replacements.
265
-
- Deprecated `BAGGAGE_HEADER_NAME`. Use `"baggage"` string constant directly instead.
281
+
- Deprecated `BAGGAGE_HEADER_NAME`. Use the `"baggage"` string constant directly instead.
266
282
- Deprecated `makeFifoCache`. No replacements.
267
283
- Deprecated `dynamicRequire`. No replacements.
268
284
- Deprecated `flatten`. No replacements.
@@ -284,13 +300,13 @@ The Sentry metrics beta has ended and the metrics API has been removed from the
284
300
285
301
## `@sentry/nestjs`
286
302
287
-
- Deprecated `@WithSentry`. Use `@SentryExceptionCaptured` instead.
288
-
- Deprecated `SentryTracingInterceptor`.
303
+
- Deprecated the `@WithSentry` decorator. Use the `@SentryExceptionCaptured` decorator instead.
304
+
- Deprecated the `SentryTracingInterceptor` method.
289
305
If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`.
290
-
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor`afterwards.
306
+
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor`afterward.
291
307
- Deprecated `SentryService`.
292
308
If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`.
293
-
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService`afterwards.
309
+
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService`afterward.
294
310
- Deprecated `SentryGlobalGenericFilter`.
295
311
Use the `SentryGlobalFilter` instead.
296
312
The `SentryGlobalFilter` is a drop-in replacement.
@@ -314,45 +330,47 @@ The Sentry metrics beta has ended and the metrics API has been removed from the
314
330
## `@sentry/vue`
315
331
316
332
- Deprecated `tracingOptions`, `trackComponents`, `timeout`, `hooks` options everywhere other than in the `tracingOptions` option of the `vueIntegration()`.
317
-
These options should now be set as follows:
318
-
319
-
```ts
320
-
import*asSentryfrom'@sentry/vue';
321
-
322
-
Sentry.init({
323
-
integrations: [
324
-
Sentry.vueIntegration({
325
-
tracingOptions: {
326
-
trackComponents: true,
327
-
timeout: 1000,
328
-
hooks: ['mount', 'update', 'unmount'],
329
-
},
330
-
}),
331
-
],
332
-
});
333
-
```
333
+
334
+
These options should now be set as follows:
335
+
336
+
```ts
337
+
import*asSentryfrom'@sentry/vue';
338
+
339
+
Sentry.init({
340
+
integrations: [
341
+
Sentry.vueIntegration({
342
+
tracingOptions: {
343
+
trackComponents: true,
344
+
timeout: 1000,
345
+
hooks: ['mount', 'update', 'unmount'],
346
+
},
347
+
}),
348
+
],
349
+
});
350
+
```
334
351
335
352
## `@sentry/nuxt` and `@sentry/vue`
336
353
337
354
- When component tracking is enabled, "update" spans are no longer created by default.
338
-
Add an `"update"` item to the `tracingOptions.hooks` option via the `vueIntegration()` to restore this behavior.
339
-
340
-
```ts
341
-
Sentry.init({
342
-
integrations: [
343
-
Sentry.vueIntegration({
344
-
tracingOptions: {
345
-
trackComponents: true,
346
-
hooks: [
347
-
'mount',
348
-
'update', // <--
349
-
'unmount',
350
-
],
351
-
},
352
-
}),
353
-
],
354
-
});
355
-
```
355
+
356
+
Add an `"update"` item to the `tracingOptions.hooks` option via the `vueIntegration()` to restore this behavior.
357
+
358
+
```ts
359
+
Sentry.init({
360
+
integrations: [
361
+
Sentry.vueIntegration({
362
+
tracingOptions: {
363
+
trackComponents: true,
364
+
hooks: [
365
+
'mount',
366
+
'update', // <--
367
+
'unmount',
368
+
],
369
+
},
370
+
}),
371
+
],
372
+
});
373
+
```
356
374
357
375
## `@sentry/astro`
358
376
@@ -364,16 +382,16 @@ The Sentry metrics beta has ended and the metrics API has been removed from the
364
382
365
383
## `@sentry/react`
366
384
367
-
- Deprecated `wrapUseRoutes`. Use `wrapUseRoutesV6` or `wrapUseRoutesV7` instead.
368
-
- Deprecated `wrapCreateBrowserRouter`. Use `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` instead.
385
+
- Deprecated `wrapUseRoutes`. Use the `wrapUseRoutesV6` or `wrapUseRoutesV7` methods instead.
386
+
- Deprecated `wrapCreateBrowserRouter`. Use the `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` methods instead.
369
387
370
388
## `@sentry/nextjs`
371
389
372
-
- Deprecated `hideSourceMaps`. No replacements. The SDK emits hidden sourcemaps by default.
390
+
- Deprecated the `hideSourceMaps` option. There are no replacements for this option. The SDK emits hidden sourcemaps by default.
373
391
374
392
## `@sentry/opentelemetry`
375
393
376
-
- Deprecated `generateSpanContextForPropagationContext`in favor of doing this manually - we do not need this export anymore.
394
+
- Deprecated the `generateSpanContextForPropagationContext`method. There are no replacements for this method.
377
395
378
396
## Server-side SDKs (`@sentry/node` and all dependents)
0 commit comments