Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple calls to AddFusionGatewayServer() result in mismatched schemas #7386

Open
andrew-brad-cmg opened this issue Aug 20, 2024 · 0 comments
Assignees

Comments

@andrew-brad-cmg
Copy link

andrew-brad-cmg commented Aug 20, 2024

Product

Hot Chocolate

Version

13.9.10

Link to minimal reproduction

https://github.com/andrew-brad-cmg/hot-chocolate-fusion-multiple-gateway-bug

Steps to reproduce

Copying steps from the readme on that repo:

  • Clone and build the repo. Open a terminal from the root: dotnet build
  • Run a dotnet tool restore
  • Pack Accounts subgraph and compose it into gateway1.fgp:
dotnet fusion subgraph pack -w ./Subgraphs/Accounts/src;
dotnet fusion compose --subgraph-package-file ./Subgraphs/Accounts/src/Account.fsp --package-file ./Gateway/Gateway1/gateway1;
  • Observe/validate the produced gateway1.fgp file.
  • Pack Reviews subgraph and compose it into gateway2.fgp:
dotnet fusion subgraph pack -w ./Subgraphs/Reviews/;
dotnet fusion compose --subgraph-package-file ./Subgraphs/Reviews/Review.fsp --package-file ./Gateway/Gateway2/gateway2;
  • Observe/validate the produced gateway2.fgp file.
  • Run the gateway (running the subgraph projects is not technically necessary)
  • Visit http://localhost:5000/graphql/ and ensure Banana Cake Pop UI loads. Ensure schema endpoint: http://localhost:5000/graphql/
  • Loading the schema in BCP, observe that it is incorrectly loading the Reviews schema. If you load the other schema endpoint http://localhost:5000/api/, you will see the correct schema for that, which is Reviews.
  • We have determined that order of operations influences this, which is to say that you can invoke AddFusionGatewayServer() with gateway 2 first, followed by gateway1. In that scenario, the Accounts subgraph will "win" (i.e. show for both schema endpoints).
  • fgp files can be rebuilt and inspected as desired for reproducton, to the best of our knowledge they are correctly packaging all artifacts.
rm -rf ./Gateway/bin;rm -rf ./Gateway/Gateway1/*;rm -rf ./Gateway/Gateway2/*; dotnet build;
(then repeat previous commands)

What is expected?

The Accounts schema should be hosted and viewable at schema endpoint http://localhost:5000/graphql/
The Reviews schema should be hosted and viewable at schema endpoint http://localhost:5000/api/

What is actually happening?

Only the Reviews schema is coming back from both endpoints. We've refreshed Banana Cake Pop UI, and also exported the schemas to .graphql files using CLI. This same behavior remains, where Accounts schema is nowhere to be found, despite being present in the fgp artifact.

Relevant log output

No response

Additional context

See readme in the repo: switching the order of operations such that gateway2 is invoked first followed by gateway1, results in only the Accounts schema being available. Same fgp files.

@andrew-brad-cmg andrew-brad-cmg added the 🐛 bug Something isn't working label Aug 20, 2024
@michaelstaib michaelstaib self-assigned this Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants