Skip to content

fix(apollo): stop the graphql-ws server of the federation driver - #4186

Merged
kamilmysliwiec merged 1 commit into
masterfrom
fix/federation-driver-stop-subscriptions
Oct 26, 2026
Merged

kamilmysliwiec merged 1 commit into
masterfrom
fix/federation-driver-stop-subscriptions

Conversation

@kamilmysliwiec

Copy link
Copy Markdown
Member

PR Checklist

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)

PR Type

  • Bugfix

What is the current behavior?

ApolloFederationDriver creates a GraphQLWsSubscriptionService when subscriptions is set (added in #3682), but it has no stop() override. ApolloBaseDriver.stop() only stops the Apollo server, so on app.close() the graphql-ws server is never disposed: open subscription connections drop with code 1006 instead of being closed with 1001, and graphql-ws's onClose and the subscription iterators' return() cleanup never run. ApolloDriver already stops it.

Issue Number: N/A

What is the new behavior?

ApolloFederationDriver.stop() stops the subscription service, then the Apollo server, as ApolloDriver does.

tests/subscriptions/subscriptions-shutdown.spec.ts opens a graphql-ws connection and closes the app, for both drivers. On master the federation case fails (expected 1006 to be 1001); both pass with the fix.

Does this PR introduce a breaking change?

  • Yes
  • No

ApolloFederationDriver creates a GraphQLWsSubscriptionService when
subscriptions are enabled, but had no stop() of its own: the base driver
only stops the Apollo server. On app.close() the graphql-ws server was
never disposed, so open connections dropped with 1006 instead of being
closed with 1001, and their onClose and iterator cleanup didn't run.
Stop it the way ApolloDriver does.
@kamilmysliwiec
kamilmysliwiec merged commit e7c7989 into master Oct 26, 2026
1 check passed
@kamilmysliwiec kamilmysliwiec mentioned this pull request Oct 26, 2026
1 task done
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.

1 participant