From 26584d1968b42d7467041d66b0d4eac3f9b1dd2b Mon Sep 17 00:00:00 2001 From: JongWoo Ha Date: Sat, 21 Nov 2026 21:50:19 +0900 Subject: [PATCH 1/2] fix(plugin-sentry): support Sentry 11 span name source attribute @sentry/core 11 removed SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ("sentry.source") and reads the span name source from "sentry.segment.name.source", so importing the plugin failed with Sentry 11 even though the peer range allows it. Pick the attribute key from the installed SDK_VERSION instead of importing the removed constant. Co-Authored-By: Claude Opus 5.5 --- .changeset/sentry-v11-segment-source.md | 5 +++++ extensions/plugin-sentry/src/attributes.ts | 12 ++++++++++++ extensions/plugin-sentry/src/integration.ts | 2 +- extensions/plugin-sentry/src/sentryPlugin.ts | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .changeset/sentry-v11-segment-source.md create mode 100644 extensions/plugin-sentry/src/attributes.ts diff --git a/.changeset/sentry-v11-segment-source.md b/.changeset/sentry-v11-segment-source.md new file mode 100644 index 000000000..4aab535ea --- /dev/null +++ b/.changeset/sentry-v11-segment-source.md @@ -0,0 +1,5 @@ +--- +"@stackflow/plugin-sentry": patch +--- + +Support Sentry 11. `@sentry/core` 11 removed `SEMANTIC_ATTRIBUTE_SENTRY_SOURCE`, so importing the plugin failed. The plugin now sets the span name source on `sentry.segment.name.source` with Sentry 11 and on `sentry.source` with Sentry 8-10. diff --git a/extensions/plugin-sentry/src/attributes.ts b/extensions/plugin-sentry/src/attributes.ts new file mode 100644 index 000000000..e8fe80595 --- /dev/null +++ b/extensions/plugin-sentry/src/attributes.ts @@ -0,0 +1,12 @@ +import { SDK_VERSION } from "@sentry/core"; + +/** + * Span attribute holding the transaction (segment) name source. + * Sentry 8-10 read `sentry.source`. Sentry 11 reads `sentry.segment.name.source` + * and no longer exports `SEMANTIC_ATTRIBUTE_SENTRY_SOURCE`, so the key is chosen + * from the installed SDK version instead of importing the constant. + */ +export const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = + Number.parseInt(SDK_VERSION, 10) >= 11 + ? "sentry.segment.name.source" + : "sentry.source"; diff --git a/extensions/plugin-sentry/src/integration.ts b/extensions/plugin-sentry/src/integration.ts index 9f4a2f3e9..4477209ac 100644 --- a/extensions/plugin-sentry/src/integration.ts +++ b/extensions/plugin-sentry/src/integration.ts @@ -5,8 +5,8 @@ import { import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from "@sentry/core"; +import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from "./attributes"; export function stackflowBrowserTracingIntegration( options: Parameters[0] = {}, diff --git a/extensions/plugin-sentry/src/sentryPlugin.ts b/extensions/plugin-sentry/src/sentryPlugin.ts index 67a9bcd72..3a02eed5b 100644 --- a/extensions/plugin-sentry/src/sentryPlugin.ts +++ b/extensions/plugin-sentry/src/sentryPlugin.ts @@ -2,9 +2,9 @@ import * as Sentry from "@sentry/browser"; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from "@sentry/core"; import type { StackflowPlugin } from "@stackflow/core"; +import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from "./attributes"; type NavigationAction = | "push" From 34105bb03984565700967e4175269b264ef2bba6 Mon Sep 17 00:00:00 2001 From: JongWoo Ha Date: Sat, 21 Nov 2026 22:20:59 +0900 Subject: [PATCH 2/2] fix(plugin-sentry): read SDK_VERSION from @sentry/browser The spans are started through @sentry/browser, so pick the name source key from the browser SDK's version rather than a directly installed @sentry/core that may be a different major. Co-Authored-By: Claude Opus 5.5 --- extensions/plugin-sentry/src/attributes.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extensions/plugin-sentry/src/attributes.ts b/extensions/plugin-sentry/src/attributes.ts index e8fe80595..0bf977178 100644 --- a/extensions/plugin-sentry/src/attributes.ts +++ b/extensions/plugin-sentry/src/attributes.ts @@ -1,10 +1,11 @@ -import { SDK_VERSION } from "@sentry/core"; +import { SDK_VERSION } from "@sentry/browser"; /** * Span attribute holding the transaction (segment) name source. * Sentry 8-10 read `sentry.source`. Sentry 11 reads `sentry.segment.name.source` * and no longer exports `SEMANTIC_ATTRIBUTE_SENTRY_SOURCE`, so the key is chosen - * from the installed SDK version instead of importing the constant. + * from the `@sentry/browser` version instead of importing the constant. The spans + * are started through `@sentry/browser`, so its version decides which key is read. */ export const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = Number.parseInt(SDK_VERSION, 10) >= 11