nestjs / nestjs/graphql

Subscriptions not working properly with Mercurius Federation

Open
#2,162 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs triage
Dominant language
TypeScript
Stars
1.6k
Forks
432
Avg merge
2d 6h
Merged PRs (30d)
26

Description

Is there an existing issue for this?
  • I have searched the existing issues
Current behavior

The subscription of individual service works fine directly but it is not working with Federation gateway

Minimum reproduction code

https://github.com/all2pie/Nestjs-Mercurius-Federation-Subscription-Bug

Steps to reproduce
  • npm i
  • nest start service --watch
  • nest start gateway --watch
  • Try this Subscription
    subscription {
      test
    }
    

subscription url: ws://localhost/graphql

Expected behavior

Subscriptions should work correctly

Package version

10.0.10

Graphql version
"@apollo/subgraph": "^0.4.2",
"@nestjs/common": "^8.0.0",
"@nestjs/core": "^8.0.0",
"@nestjs/graphql": "^10.0.10",
"@nestjs/mercurius": "^10.0.9",
"@nestjs/platform-fastify": "^8.4.4",
"graphql": "^16.4.0",
"mercurius": "^9.3.6",
NestJS version

8.2.2

Node.js version

16.14.0

In which operating systems have you tested?
  • macOS
  • Windows
  • Linux
Other

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked Nestjs-Mercurius-Federation-Subscription-Bug reproduction and run npm i, then start the service and gateway with the listed nest start commands. Test the subscription at ws://localhost/graphql; done means the test subscription works through the federation gateway as it does directly against the individual service.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, node.js, typescript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.