Skip to content

Commit 63aee31

Browse files
fix(gql): Revert signature change of patched gql.Client.execute
1 parent d781b88 commit 63aee31

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sentry_sdk/integrations/gql.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,23 @@ def _request_info_from_transport(
9595
def _patch_execute() -> None:
9696
real_execute = gql.Client.execute
9797

98+
# Maintain signature for backwards compatibility.
99+
# gql.Client.execute() accepts a positional-only "request"
100+
# parameter with version 4.0.0.
98101
@ensure_integration_enabled(GQLIntegration, real_execute)
99102
def sentry_patched_execute(
100103
self: "gql.Client",
101-
document_or_request: "DocumentNode",
104+
document: "DocumentNode",
102105
*args: "Any",
103106
**kwargs: "Any",
104107
) -> "Any":
105108
scope = sentry_sdk.get_isolation_scope()
106-
scope.add_event_processor(_make_gql_event_processor(self, document_or_request))
109+
# document is a gql.GraphQLRequest with gql v4.0.0.
110+
scope.add_event_processor(_make_gql_event_processor(self, document))
107111

108112
try:
109-
return real_execute(self, document_or_request, *args, **kwargs)
113+
# document is a gql.GraphQLRequest with gql v4.0.0.
114+
return real_execute(self, document, *args, **kwargs)
110115
except TransportQueryError as e:
111116
event, hint = event_from_exception(
112117
e,

0 commit comments

Comments
 (0)