Skip to content

fix(core): Only create Supabase db spans when there is a parent span - #25807

Open
chiliec wants to merge 4 commits into
getsentry:developfrom
chiliec:fix/supabase-only-if-parent
Open

chiliec wants to merge 4 commits into
getsentry:developfrom
chiliec:fix/supabase-only-if-parent

Conversation

@chiliec

@chiliec chiliec commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Closes #25806

The supabase integration creates db spans even when there is no active span, so each query becomes its own root span with no context.

Fix

Pass onlyIfParent: true to both startSpanManual calls in packages/core/src/integrations/supabase.ts (the auth wrapper and the PostgREST query wrapper). A query made without an active parent span now creates no span — e.g. in the browser, queries after the pageload/navigation span has ended.

Tests

Added an onlyIfParent suite to packages/core/test/lib/integrations/supabase.test.ts asserting both the PostgREST and auth paths pass onlyIfParent: true.

Validation

Node 24.22.1, pnpm 12.11.2.

RED (before the src change): the two new tests fail — expected undefined to be true.
GREEN (with the fix): full file passes.

$ npx vitest run test/lib/integrations/supabase.test.ts
 Test Files  1 passed (1)
      Tests  38 passed (38)

npx oxlint and npx oxfmt --check on both files are clean. CHANGELOG updated under Unreleased.

Pass onlyIfParent to the Supabase auth and PostgREST startSpanManual
calls so a query made without an active span no longer becomes its own
root span.
@chiliec
chiliec requested review from a team as code owners October 28, 2026 11:03
@chiliec
chiliec requested review from andreiborza, isaacs, logaretm and msonnb and removed request for a team October 28, 2026 11:03
@github-actions github-actions Bot added the external PR from an external contributor label Oct 28, 2026
@chiliec
chiliec requested review from chargome and nicohrubec and removed request for a team October 28, 2026 11:04
Comment thread packages/core/test/lib/integrations/supabase.test.ts Outdated
Comment thread packages/core/test/lib/integrations/supabase.test.ts Outdated
Comment thread CHANGELOG.md Outdated

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external PR from an external contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Only create supabase db spans when there is a parent span

2 participants