question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apollo Federation help and sample

See original GitHub issue

Hi @Shane32 @joemcbride @sungam3r2022 ,

I created a Github repo and added detailed explanations and steps in README. Please check it out. Structure is like;

D:\DEV\GIT\GRAPHQL.NET-IN-APOLLO-FEDERATION
├───country-subgraph
│   └───src
│       └───country
│           ├───dto
│           └───entities
├───federation-gateway
│   └───src
├───food-subgraph
│   └───src
│       └───restaurant
│           ├───dto
│           └───entities
└───starwars-subgraph
    ├───StarWars
    │   └───Types
    └───WebApi
        ├───Controllers
        └───Properties

country-subgraph, food-subgraph & federation-gateway are created by NestJS and use ApolloServer. Gateway don’t care if the subgraphs are code-firts or SDL-first. While the country-subgraph is code-first, food-subgraph is SDL-first. They’re functional. You can try it following the steps in README.

starwars-subgraph is created with GraphQL.NET 4.7.1. You can add it to gateway just uncommenting a few lines . Below errors occur when added,

(node:3892) UnhandledPromiseRejectionWarning: Error: Couldn't load service definitions for "starwars"
    at C:\murat\graphql.net-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\supergraphManagers\IntrospectAndCompose\loadServicesFromRemoteEndpoint.ts:77:15
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Promise.all (index 2)
    at loadServicesFromRemoteEndpoint (C:\murat\graphql.net-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\supergraphManagers\IntrospectAndCompose\loadServicesFromRemoteEndpoint.ts:81:30)
    at IntrospectAndCompose.updateSupergraphSdl (C:\murat\graphql.net-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\supergraphManagers\IntrospectAndCompose\index.ts:95:20)
    at IntrospectAndCompose.initialize (C:\murat\graphql.net-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\supergraphManagers\IntrospectAndCompose\index.ts:65:30)
    at ApolloGateway.initializeSupergraphManager (C:\murat\graphql.net-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\index.ts:456:22)
    at ApolloGateway.load (C:\murat\graphql.net-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\index.ts:351:7)
    at SchemaManager.start (C:\murat\graphql.net-apollo-federation\federation-gateway\node_modules\apollo-server-core\src\utils\schemaManager.ts:111:22)
    at ApolloServer._start (C:\murat\graphql.net-apollo-federation\federation-gateway\node_modules\apollo-server-core\src\ApolloServer.ts:359:24)

I guess, Apollo Gateway sends an introspection query and it failes. I may be doing something wrong, not sure. Maybe it can be fixed easily.

Importance of being able to add our graphql.net as subgraph to an existing Apollo Federation is really huge. When we achieve it, we’ll be able to use our legacy codebases which are in Graphql.Net 2. We’ll just upgrade to 4.7.1 and add it to our Apollo Server. So, we won’t need to change the codebase! Would be wonderful 😃

As seen here, we’re not trying to create the gateway with Graphql.Net. Gateway already exists. Apollo Federation is running. We just need to add our GraphQL.Net 4 app as a subgraph.

I’d send a PR for this sample gladly, when we put it to a final shape. I’d like to help for this in any way I can…

Thanks & regards

_Originally posted by @killjoy2013 in https://github.com/graphql-dotnet/examples/issues/91#issuecomment-1059769411_

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
sungam3r2022commented, Mar 5, 2022

Thanks for the example @killjoy2013. It will help me when I return to my work on Federation.

0reactions
sungam3r2022commented, Mar 7, 2022

I found this documentation some time ago and keep it opened among one of the ~200 other tabs in order not to forget.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to Apollo Federation - Apollo GraphQL Docs
Apollo GraphOS provides a managed mode for Apollo Federation, which helps you modify and grow your supergraph without any downtime. Get started with...
Read more >
Federation 2 quickstart
Example subgraphs. This tutorial uses two Apollo-hosted subgraphs (named Locations and Reviews) from an imaginary space tourism application called FlyBy.
Read more >
Introduction to Apollo Federation
Implement a single graph across multiple services.
Read more >
Apollo Federation Demo
This repository is a demo of using Apollo Federation to build a single schema on top of multiple services. The microservices are located...
Read more >
Federation quickstart - Apollo GraphQL Docs
1. Provide subgraph details · routing_url is the URL the router will use to send GraphQL operations to the subgraph at runtime. ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found