apollographql / apollographql/federation

Federation: Middlewares have no effect?

Open
#366 5 comments 8 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
725
Forks
276
Avg merge
1h 47m
Merged PRs (30d)
1

Description

I am trying to use `graphql-shield` on my gateway server. It seems like while the shield is called, the error from the shield does not make it to the user. My guess is that the `executor` is somehow overriding the result from the middleware.

Is there a documented way of using middlewares with apollo-gateway?

If it is currently not possible to use middlewares with apollo-gateway, this is a feature request :grin:

```typescript
const { schema: federatedSchema, executor } = await gateway.load();

const server = new ApolloServer({
schema: applyMiddleware(
federatedSchema,
shield(
{
Query: deny,
Mutation: deny
},
{
debug: true
}
)
),
executor
});

```

Contributor guide

Open the contributing guide

Research direction

Start with the gateway.load() result and its executor, then trace how the ApolloServer setup combines that executor with applyMiddleware and shield. Reproduce the shown TypeScript configuration and determine whether middleware errors reach the user; done means either middleware behavior is supported and documented or the limitation and required feature are clearly defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.