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
The plugin now also applies the build-time instrumentation transform. If you added `sentryOrchestrionPlugin()` from `@sentry/server-utils/orchestrion/vite` to your Vite config manually, remove it. Opt out with `sentryRemixVitePlugin({ buildTimeInstrumentation: false })`.
1305
1311
1312
+
### React: Simpler React Router setup via `@sentry/react/react-router`
1313
+
1314
+
Affected SDKs: `@sentry/react`.
1315
+
1316
+
`@sentry/react` gained a new `@sentry/react/react-router` entry point that pulls the required React Router hooks (`useLocation`, `useNavigationType`, `matchRoutes`, `createRoutesFromChildren`) from `react-router` for you, so you no longer have to thread them through `reactRouterBrowserTracingIntegration` yourself:
1317
+
1318
+
```diff
1319
+
- import * as Sentry from '@sentry/react';
1320
+
- import { useEffect } from 'react';
1321
+
- import { createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from 'react-router';
1322
+
+ import * as Sentry from '@sentry/react';
1323
+
+ import { reactRouterBrowserTracingIntegration } from '@sentry/react/react-router';
1324
+
1325
+
Sentry.init({
1326
+
integrations: [
1327
+
- Sentry.reactRouterBrowserTracingIntegration({
1328
+
- useEffect,
1329
+
- useLocation,
1330
+
- useNavigationType,
1331
+
- createRoutesFromChildren,
1332
+
- matchRoutes,
1333
+
- }),
1334
+
+ reactRouterBrowserTracingIntegration(),
1335
+
],
1336
+
});
1337
+
```
1338
+
1339
+
The `wrapReactRouterRouting`, `wrapUseRoutes`, `wrapCreateBrowserRouter` and `wrapCreateMemoryRouter` helpers are re-exported from `@sentry/react/react-router` as well.
1340
+
1341
+
This entry requires `react-router` to be resolvable — it is declared as an optional peer dependency and supports React Router v6, v7 and v8. If you are on React Router v6 with only `react-router-dom` installed, either add `react-router` as a dependency or keep importing `reactRouterBrowserTracingIntegration` from `@sentry/react` and pass the hooks explicitly.
1342
+
1343
+
The existing `@sentry/react` API is unchanged and keeps working; passing the hooks there is now optional too (`useEffect` in particular is no longer used and can be omitted).
1344
+
1345
+
Additionally — for **every** `@sentry/react` routing setup, not just the new entry — the order in which you add the browser tracing integration and wrap your routes no longer matters.
1346
+
1306
1347
## 3. Removed APIs
1307
1348
1308
1349
### `@sentry/core` / All SDKs
@@ -2133,6 +2174,7 @@ The main entry re-exported the build plugin statically, which pulled the whole b
2133
2174
`any`.
2134
2175
- Attribute typing and serialization were unified across the SDK.
2135
2176
- The `attributes` field on the `ScopeData` type is now required. `Scope.getScopeData()` always returned it, so this only affects code that constructs `ScopeData` objects manually — add `attributes: {}` there.
2177
+
- The `attributes` field on the `SamplingContext` passed to `tracesSampler` is now required (previously optional); it is always provided by the SDK, so this only affects code that narrows or constructs `SamplingContext` objects by hand.
2136
2178
- The `endTimestamp` property was removed from the `SentrySpanArguments` interface. It was never part of
2137
2179
`StartSpanOptions`, so it could only be passed by ignoring TypeScript, in which case the span ended itself
2138
2180
during construction. Call `span.end(timestamp)` instead.
Copy file name to clipboardExpand all lines: dev-packages/cloudflare-integration-tests/suites/vite-autoinstrument/durableobject-reexport-instrumented/index.ts
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -8,10 +8,11 @@ interface Env {
8
8
// `Counter` is imported from another module (`./counter`) where it was already
9
9
// manually wrapped with `instrumentDurableObjectWithSentry`, then re-exported
10
10
// here. The auto-instrument transform runs over this entry and sees
11
-
// `export { Counter }`, but `Counter` is an imported binding — not a local class
12
-
// declaration — so it cannot (and must not) wrap it. The DO stays instrumented
13
-
// solely via the manual wrap in `./counter`, and the plain default export below
14
-
// is still auto-wrapped with `withSentry`.
11
+
// `export { Counter }`, but nothing in this file reveals that the binding is
12
+
// already wrapped, so it emits its wrapper behind a guard
13
+
// (`_INTERNAL_wrapUnlessInstrumented`) that returns the manual wrap unchanged
14
+
// instead of nesting. The plain default export below is still auto-wrapped
Copy file name to clipboardExpand all lines: dev-packages/cloudflare-integration-tests/suites/vite-autoinstrument/durableobject-reexport-instrumented/test.ts
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -43,12 +43,13 @@ function expectMainWorkerTransaction(transactionEvent: TransactionEvent): void {
43
43
44
44
// `Counter` is manually wrapped with `instrumentDurableObjectWithSentry` in a
45
45
// separate module (`./counter`), imported into the entry, and re-exported via a
46
-
// plain `export { Counter }`. Because `Counter` is an imported binding rather
47
-
// than a local class declaration, the transform cannot wrap it in the entry and
48
-
// must leave it alone — no double-wrap, no broken build. The DO stays
49
-
// instrumented via the manual wrap, so we still expect a storage-bearing DO
50
-
// transaction, alongside the auto-wrapped default export's child-less one.
51
-
it('leaves an imported, already-instrumented Durable Object untouched and still wraps the default export',async({
46
+
// plain `export { Counter }`. The transform sees only the imported binding, so it
47
+
// emits its wrapper behind `_INTERNAL_wrapUnlessInstrumented`, which recognizes
48
+
// the hand-wrapped class and hands it straight back. Without that guard the two
49
+
// wrappers nest and every storage call reports twice, so the exactly-two span
50
+
// assertion below is the real check. The DO stays instrumented via the manual
51
+
// wrap, alongside the auto-wrapped default export's child-less transaction.
52
+
it('does not double-instrument an imported, already-wrapped Durable Object and still wraps the default export',async({
0 commit comments