Releases: strawberry-graphql/strawberry
0.315.3
This release fixes the Channels integration when using cross-web 0.6.0 or newer.
cross-web now requires request adapters to expose path_params, so Strawberry's
Channels HTTP adapters now read them from the Channels url_route scope.
This release was contributed by @patrick91 in #4390
0.315.2
0.315.1
Raise MissingFieldAnnotationError instead of MissingReturnAnnotationError when a field using strawberry.field(resolver=...) is missing both a type annotation and a resolver return type.
This release was contributed by @youngjaekwon in #4360
Additional contributors: @pre-commit-ci[bot]
0.315.0
Cancel DataLoader dispatch task when all futures are cancelled.
Previously, the background task created by dispatch() was fire-and-forget — its
reference was never stored, so it couldn't be cancelled even when no caller was
waiting for the results. This caused wasted work (e.g. database queries against
closed sessions) when using asyncio.TaskGroup or similar structured concurrency
patterns that cancel futures on failure.
The dispatch task is now tracked in Batch._dispatch_task and automatically
cancelled when all futures in the batch are cancelled.
This release was contributed by @ChihebBENCHEIKH1 in #4379
0.314.3
0.314.2
This release fixes a bug in _listen_to_channel_generator where yield await awaitable inside try/except asyncio.TimeoutError caused the yield to fall
within the try block's bytecode exception table range.
This meant that a TimeoutError thrown into the generator at the yield point
(i.e. when the generator is suspended after delivering a value) was incorrectly
caught by the internal timeout handler, silently stopping the generator instead
of propagating to the caller. In production, this could manifest as
RuntimeError: cannot reuse already awaited coroutine during WebSocket
disconnect cleanup.
The fix splits yield await awaitable into result = await awaitable followed
by yield result, so the yield is outside the try block and exceptions
thrown at the yield point propagate correctly.
0.314.1
This release attaches error details to Apollo Federation inline tracing (FTV1) trace nodes. This was missing in the original FTV1 addition made in 0.314.0.
When a resolver raises an exception, the error message, location, and path are now included in the corresponding trace node, allowing Apollo Studio to display error information alongside timing data.
This release was contributed by @FineAndDanD in #4351
Additional contributors: @bellini666
0.314.0
This release adds support for Apollo Federation inline tracing (FTV1).
When a request includes the apollo-federation-include-trace: ftv1 header, Strawberry now records per-resolver timing information and includes it in the response under extensions.ftv1 as a base64-encoded protobuf message, following the Apollo Federation trace format. This allows an Apollo Gateway to aggregate subgraph traces and report them to Apollo Studio.
Install the new optional extra to pull in the required protobuf dependency:
pip install 'strawberry-graphql[apollo-federation]'Use the async extension for async schemas:
import strawberry
from strawberry.extensions.tracing import ApolloFederationTracingExtension
@strawberry.type
class Query:
@strawberry.field
def hello(self) -> str:
return "Hello, world!"
schema = strawberry.Schema(
query=Query,
extensions=[ApolloFederationTracingExtension],
)Or the sync version when running outside of an async context:
from strawberry.extensions.tracing import ApolloFederationTracingExtensionSync
schema = strawberry.Schema(
query=Query,
extensions=[ApolloFederationTracingExtensionSync],
)Security: any client can send the
apollo-federation-include-trace: ftv1header unless you restrict it. Tracing payloads expose resolver timing details, so make sure only a trusted Apollo Gateway (or other internal traffic) can request traces — for example by enforcing authentication, network policy, or stripping the header from public requests at the edge.\
Release contributed by @bellini666 via #4136
🍓 0.313.0
🍓 0.312.4
Fix a memory leak in the graphql-transport-ws WebSocket handler where completed
task objects would accumulate in a list between messages. Task cleanup now uses
asyncio.Task.add_done_callback for immediate cleanup instead of deferred reaping.
Releases contributed by @bellini666 via #4345