-
-
Notifications
You must be signed in to change notification settings - Fork 799
Description
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.fgpfile. - 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.fgpfile. - 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
Reviewsschema. If you load the other schema endpointhttp://localhost:5000/api/, you will see the correct schema for that, which isReviews. - 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, theAccountssubgraph will "win" (i.e. show for both schema endpoints). fgpfiles 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.