Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External schema stitching in lighthouse for setting up a gateway #865

Closed
patrickwiggelman opened this issue Jul 17, 2019 · 2 comments
Closed
Labels
discussion Requires input from multiple people enhancement A feature or improvement

Comments

@patrickwiggelman
Copy link

patrickwiggelman commented Jul 17, 2019

Description
We're setting up a microservices landscape with a Gateway and private services in Laravel/GraphQL with Lighthouse. In our Gateway we do our authentication and authorization with passport, gates and policies for users. And of course with Lighthouse directives @auth and @can in our GraphQL schema in the Gateway.

Problem
Lighthouse can't stitch external graphql schema's/services out of the box, by my knowledge.

Question
So, what's the best way to consume the graphql services (Laravel with lighthouse) from the gateway (also Laravel with Lighthouse), so we can do authorization on every query, mutation and subscription in our gateway?

Solution
We know about the concept stitching in GraphQL, so you van stitch external graphQL schema's to one schema (for us the gateway graphQL schema). So we have one schema, and one document to see what's possible for frontend. This seams to me the best solution.

Alternative
Our alternative is to pass incoming requests for the Laravel GraphQL Lighthouse Gateway, and delegate it to the right GraphQL service(s) with a GrapQL request (with guzzle) in the resolve function. And pass the response of it back to the client through the Gateway. The downside of this, is many code and different GraphQL schema's instead of one.

@spawnia spawnia added discussion Requires input from multiple people enhancement A feature or improvement labels Jul 17, 2019
@renepardon
Copy link

I need a similar solution. Would be nice if someone has a working example to do this.

@joskfg
Copy link
Collaborator

joskfg commented Oct 14, 2019

Stiching is already deprecated, so I would implement federation instead of this.

https://www.apollographql.com/docs/graphql-tools/schema-stitching/

Deprecated: Federation is our replacement for schema stitching that enables developers to declaratively compose a distributed graph. Learn why in our blog post and how to migrate in the federation guide.

Related issue: #911

@joskfg joskfg closed this as completed Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Requires input from multiple people enhancement A feature or improvement
Projects
None yet
Development

No branches or pull requests

4 participants