aws-appsync-community icon indicating copy to clipboard operation
aws-appsync-community copied to clipboard

AppSync with Apollo Federation/Gateway

Open Glen-Moonpig opened this issue 6 years ago β€’ 41 comments

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?

Glen-Moonpig avatar Jun 21 '19 10:06 Glen-Moonpig

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!

Glen-Moonpig avatar Jul 01 '19 10:07 Glen-Moonpig

Hi,

Thanks for the feedback! I'll note this down as a feature request and bring it back to the team.

jbailey2010 avatar Jul 11 '19 18:07 jbailey2010

@jbailey2010 Is there an update on this or a designated thread?

david-novicki avatar Aug 26 '19 18:08 david-novicki

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.

0xR avatar Oct 10 '19 14:10 0xR

The killer feature here would be if AppSync could act as a federation gateway, removing the need to run Apollo server πŸ‘Œ

lwc avatar Jan 16 '20 02:01 lwc

@jbailey2010 Any update on this?

LmKupke avatar May 19 '20 16:05 LmKupke

Any update?

jfbaro avatar Jul 08 '20 16:07 jfbaro

I'm also curious about this.

Is there a way to use AppSync as the federated gateway entry point?

DavidWells avatar Aug 23 '20 16:08 DavidWells

Any news? πŸ‘€πŸ‡¨πŸ‡΄

MontoyaAndres avatar Nov 10 '20 12:11 MontoyaAndres

+1

lostb1t avatar Nov 28 '20 16:11 lostb1t

+1

markoff-s avatar Jan 20 '21 03:01 markoff-s

Any update on this Federation and Gateway support in AppSync?

vaptex avatar Feb 05 '21 02:02 vaptex

This is an important devops need for our team. We use amplify, which would be cool if it worked with

jakemitchellxyz avatar Feb 06 '21 07:02 jakemitchellxyz

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!

travishaby avatar Apr 14 '21 21:04 travishaby

this is absolutely required!

ncremaschini avatar May 26 '21 08:05 ncremaschini

So needed

malikalimoekhamedov avatar Jun 09 '21 13:06 malikalimoekhamedov

I'm not going to use AppSync until it supports Federation.

cazzer avatar Jun 25 '21 17:06 cazzer

This is a big issue for our company too, is it in the roadmap?

sebastiansanio avatar Jun 28 '21 19:06 sebastiansanio

This is a MUST for us.... we need an update

leandrosalo avatar Jul 20 '21 17:07 leandrosalo

Really need thi ps too, but I haven’t seen any updates in AppSync for a while so not getting hopes up.

sweepy84 avatar Jul 24 '21 10:07 sweepy84

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...

confix avatar Jul 29 '21 09:07 confix

+1

gastonsilva avatar Sep 22 '21 14:09 gastonsilva

+1

patrickacioli avatar Sep 22 '21 14:09 patrickacioli

+1

kuzbida avatar Sep 23 '21 13:09 kuzbida

+1 * 10000000

Z11 avatar Sep 25 '21 21:09 Z11

+1

friendOfOurs avatar Oct 11 '21 16:10 friendOfOurs

The killer feature here would be if AppSync could act as a federation gateway, removing the need to run Apollo server πŸ‘Œ

  • 1

saravind-hotstar avatar Oct 18 '21 13:10 saravind-hotstar

Does anyone have a workaround for this? Multiple AppSync services with a gateway service? Can I drop Apollo Federation on top of this?

shawnmclean avatar Nov 19 '21 01:11 shawnmclean

@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)

PTaylour avatar Nov 29 '21 14:11 PTaylour

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

ndejaco2 avatar Nov 29 '21 23:11 ndejaco2