AppSync with Apollo Federation/Gateway
Question:
Does AppSync work with Apollo Federation and Gateway? I have already used AppSync with Apollo Server using the schema stitching method, which is now deprecated. It looks like the new Apollo Gateway using federation requires some additional implementation from the AppSync side.
If this does not work currently are there any plans to implement this?
I spoke to Apollo about using AppSync with federation and they replied
For AWS, we would need to work with them on exposing the right entry points to AppSync, but hopefully that can be done!
Hi,
Thanks for the feedback! I'll note this down as a feature request and bring it back to the team.
@jbailey2010 Is there an update on this or a designated thread?
For now you can add a middleware service with https://github.com/0xR/graphql-transform-federation. This allows you to add any federation decorators to an existing appsync schema.
The killer feature here would be if AppSync could act as a federation gateway, removing the need to run Apollo server π
@jbailey2010 Any update on this?
Any update?
I'm also curious about this.
Is there a way to use AppSync as the federated gateway entry point?
Any news? ππ¨π΄
+1
+1
Any update on this Federation and Gateway support in AppSync?
This is an important devops need for our team. We use amplify, which would be cool if it worked with
Would love to see this! We're currently hacking a solution similar to one mentioned in a related thread with a bunch of namespaced GraphQL schemas uploaded to the same S3 bucket, which are then all being stitched together in a job and deployed to our "global" AppSync instance. A cleaner, AWS-native solution would be ideal!
this is absolutely required!
So needed
I'm not going to use AppSync until it supports Federation.
This is a big issue for our company too, is it in the roadmap?
This is a MUST for us.... we need an update
Really need thi ps too, but I havenβt seen any updates in AppSync for a while so not getting hopes up.
Unfortunately responses to almost any AppSync related issue seem to boil down to "I am going to note that down"... It seems like they want us to host ourselves... ditching AppSync for now...
+1
+1
+1
+1 * 10000000
+1
The killer feature here would be if AppSync could act as a federation gateway, removing the need to run Apollo server π
- 1
Does anyone have a workaround for this? Multiple AppSync services with a gateway service? Can I drop Apollo Federation on top of this?
@shawnmclean I gave https://github.com/0xR/graphql-transform-federation a little go but failed to get it to work with latest versions of apollo server and appsync.
Fell back to using import { stitchSchemas } from '@graphql-tools/stitch'; which seems well suited to situations where you can't easily edit existing schema (eg when using appsync with amplify):
const appSyncIntrospectionSchemaObject = JSON.parse(
fs.readFileSync(
path.join(__dirname, '../../src/graphql/schema.json'),
'utf8',
),
);
const appsyncSubSchema: SubschemaConfig = {
schema: buildClientSchema(appSyncIntrospectionSchemaObject.data),
/**
* Provide executor as this API is server from a different server to the gateway
*/
executor: createRemoteExecutor(
`https://<yourendpoint>.appsync-api.eu-west-1.amazonaws.com/graphql`,
),
};
// build the combined schema
const gatewaySchema = stitchSchemas({
subschemas: [appsyncSubSchema, ...otherSubSchemas],
});
const gateway = new ApolloServer({
schema: gatewaySchema,
context: (ctx) => ({
headers: {
'Content-Type': 'application/json',
// TODO the JWT is too long to send from apollo studio. May want to try and optimise this anyway.
Authorization: ctx.req.header('authorization'),
},
}),
});
Only prototyping at the moment, haven't tried this in production (and obviously no good if you want to use apollo federation)
A workaround for supporting federation using Apollo Gateway to federate across multiple AppSync GraphQL Apis is provided here: https://github.com/apollographql/apollo-federation-subgraph-compatibility/tree/main/implementations/appsync