Skip to content

Commit f47dee7

Browse files
author
igor.luckenkov
committed
Throw an error if client provides abort signal for subscriptions
1 parent e449cae commit f47dee7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/execution/execute.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,14 @@ export function subscribe(
16311631
): PromiseOrValue<
16321632
AsyncGenerator<ExecutionResult, void, void> | ExecutionResult
16331633
> {
1634+
// Until we have execution cancelling support in Subscriptions,
1635+
// throw an error if client provides abort signal.
1636+
if (args.signal) {
1637+
return {
1638+
errors: [new GraphQLError('Subscriptions do not support abort signals.')],
1639+
};
1640+
}
1641+
16341642
// If a valid execution context cannot be created due to incorrect arguments,
16351643
// a "Response" with only errors is returned.
16361644
const exeContext = buildExecutionContext(args);

0 commit comments

Comments
 (0)