Questions tagged [apollo-federation]

Apollo Federation is an architecture for composing multiple GraphQL services into a single graph that addresses this need. Unlike other approaches such as schema stitching, it is based on a declarative composition programming model that allows proper separation of concerns. This design allows teams to implement an enterprise-scale shared data graph as a set of loosely coupled, separately maintained GraphQL services.

https://www.apollographql.com/docs/federation/

208 questions
1
vote
1 answer

How to set environment variables in PowerShell to fetch a registered schema from Apollo Studio

I'm following Apollo Router Quickstart documentation. I am stuck on fetching the registered schema from Apollo Studio by setting environment variables. I'm using PowerShell and since this command is for Linux it doesn't work for windows. $…
1
vote
0 answers

using custom directive in apollo federation v2 gateway

Using Apollo Federation V2. In my gateway, creating context as follows; context: ({ req }) => { if (req.user) { const user = req.user; return { user }; } else { console.error( …
killjoy
  • 864
  • 17
  • 31
1
vote
1 answer

Apollo Gateway: Forward Subgraph `set-cookie` Header to Gateway to Client

I have a subgraph microservice that handles sessions. We store our sessions via cookies that the subgraph creates, and should set it via the set-cookie header. Only issue is my gateway does not seem to be forwarding the set-cookie header from the…
NateAGeek
  • 624
  • 1
  • 8
  • 22
1
vote
1 answer

Apollo Federation: A valid schema couldn't be composed. The following composition errors were found: Syntax Error: Unexpected character: U+0130

I tried to use Apollo Federation and I create an user service and gateway. User service is working alone fine but Gateway is giving an error: Error: A valid schema couldn't be composed. The following composition errors were found: Syntax…
1
vote
0 answers

How to resolve chained graphql resolvers in an array

In a child resolver in GraphQL, I want to use an API to get the data. Example schema and resolver: import { gql,ApolloServer } from "apollo-server"; const typeDefs = gql` type Review{ id: String! rating: String! comments: [String] …
1
vote
2 answers

Forward request headers - apollo federated gateway

I'm using the following versions: "@apollo/gateway": "^2.1.3" "@apollo/server": "^4.0.0" "graphql": "^16.6.0" I can't get a handle on the req object to extract the headers and forward them. The buildService code works to add headers to requests to…
Dudo
  • 4,002
  • 8
  • 32
  • 57
1
vote
0 answers

Can entities in a federated Apollo GraphQL schema have fields that are resolved separately from __resolveReference?

With a federated GraphQL model using Apollo, the docs state that "A reference resolver is responsible for returning all of the entity fields that this subgraph defines". But is it possible to have fields in a subgraph not returned from the…
nerdlinger
  • 1,610
  • 2
  • 17
  • 24
1
vote
1 answer

How to handle child objects extension in Apollo Federation

Service A: type A { id: ID! embeddedMetaData: MetaData } type MetaData{ fieldA: String } Service B: type A @key(fields: "id") { id: ID! @external #I want to extend and resolve a new field into MetaData type without overriding } How can…
1
vote
0 answers

Graphql federation - Communication between subgraphs for validation

I am trying to implement Graphql federation with multiple subgraphs using Nestjs + Apollo GraphQL. So I have USER subgraph and Application subgraph as separate Graphql services. Everything seems to be working fine when its comes to querying from the…
Midhun Murali
  • 2,089
  • 6
  • 28
  • 49
1
vote
1 answer

Apollo Federation - Subgraph healfth check in gateway

I'm implementing it as a POC in my company, Apollo Federation. And I'm not finding in the documentation how to do the health check of the subgraph so that there is no error when uploading the gateway. Is there any way to do it? my example:…
1
vote
0 answers

Apollo Federation 2 displaying query plan in apollo studio while using it as embedded

Using federation 2. I'd like to use Apollo Explorer as a landing page by setting; ApolloServerPluginLandingPageLocalDefault({ embed: true }). Works nicely. However, couldn't get query plan; Any chance to get the query plan in Apollo Explorer while…
killjoy
  • 864
  • 17
  • 31
1
vote
0 answers

Endless Loop in apollo federation API gateway context

Trying to add authentication to my appolo projects. I have the following structure Class AuthenticatedDataSource extends RemoteGraphQLDataSource { willSendRequest({request, context }) { request.http.headers.set('required-auth',…
Danis
  • 1,978
  • 3
  • 16
  • 27
1
vote
0 answers

ApolloGateway: How to make a gql call after receiving a response

I have a simple ApolloGateway server, which receives a gql mutation. What I am trying to accomplish is to make another gql mutation upon receiving a success call from the mutation call. I can see that I can use the method didReceiveResponse in order…
Seeker
  • 75
  • 1
  • 5
1
vote
0 answers

Apollo federation entity union / extending entities in same subgraph

I am currently sucessfully being able to extend types across services. Service A: type User @key(fields: "id") { id: ID! } Service B: extend type User @key(fields: "id") { id: ID! @external extendedList: [ExtendedType] } And then ofcource…
Joelgullander
  • 1,624
  • 2
  • 20
  • 46
1
vote
1 answer

Federated graphql context with gqlgen

How do you get the graphql context in a gqlgen subgraph that has been passed down from the federated graphql gateway?
hboylan
  • 357
  • 3
  • 12