Skip to content

fix(strawberry): Fix AttributeError on graphql_span in resolve#6289

Open
sentrivana wants to merge 3 commits into
masterfrom
ivana/strawberry-missing-span
Open

fix(strawberry): Fix AttributeError on graphql_span in resolve#6289
sentrivana wants to merge 3 commits into
masterfrom
ivana/strawberry-missing-span

Conversation

@sentrivana
Copy link
Copy Markdown
Contributor

@sentrivana sentrivana commented May 19, 2026

Strawberry's MiddlewareManager is cached on the schema, so resolve() runs on stale extension instances from the first request. Use start_span() instead of self.graphql_span.start_child() so resolve spans parent correctly via the scope rather than relying on instance state.

Also prepend (rather than append) the Sentry extension so it wraps all other extensions as the outermost layer and captures the whole request.

Also make all instance variables that are only used in one method local.

Description

Issues

Reminders

sentrivana and others added 2 commits May 19, 2026 10:47
Strawberry's MiddlewareManager is cached on the schema, so resolve()
runs on stale extension instances from the first request. Use
sentry_sdk.start_span() instead of self.graphql_span.start_child()
so resolve spans parent correctly via the scope rather than relying
on instance state.

Also prepend (rather than append) the Sentry extension so it wraps
all other extensions as the outermost layer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 19, 2026

PY-1919

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Codecov Results 📊

282 passed | Total: 282 | Pass Rate: 100% | Execution Time: 43.93s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 0.00%. Project has 15082 uncovered lines.
❌ Project coverage is 32.49%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
strawberry.py 8.54% ⚠️ 182 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    33.53%    32.49%    -1.04%
==========================================
  Files          190       190         —
  Lines        22342     22342         —
  Branches      7576      7576         —
==========================================
+ Hits          7492      7260      -232
- Misses       14850     15082      +232
- Partials       749       695       -54

Generated by Codecov Action

@sentrivana sentrivana changed the title fix(strawberry): Fix AttributeError on graphql_span in resolve fix(strawberry): Fix AttributeError on graphql_span in resolve May 19, 2026
@sentrivana sentrivana marked this pull request as ready for review May 19, 2026 09:43
@sentrivana sentrivana requested a review from a team as a code owner May 19, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strawberry uncaught exception

2 participants