apollographql / apollographql/federation

Support for GraphQL Multipart Requests in Federation

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

Description

Apollo Server [allows use](https://www.apollographql.com/docs/apollo-server/data/file-uploads/) of the [graphql-upload](https://www.npmjs.com/package/graphql-upload) npm module to support [GraphQL Multipart Requests](https://github.com/jaydenseric/graphql-multipart-request-spec).

While this works in isolation for requests targeted directly at subgraphs, it does not appear to be supported in the gateway:

- the design of the `RemoteGraphQLDataSource` class appears to assume that all subgraph-forwarded requests will have a JSON body and content-type.
- without adding the `graphql-upload` middleware, the gateway refuses any multipart incoming request (on the grounds of content-type matching)

Note that any gateway solution involving the need for customers to add middleware might impact support for Managed Federation (see this [question](https://community.apollographql.com/t/is-it-possible-to-apply-graphql-middleware-when-using-managed-federation/2502/2)).

We make use of multipart requests with Apollo and lack of support for multipart is a significant blocker for moving to federation.

Contributor guide

Open the contributing guide

Research direction

Start at the RemoteGraphQLDataSource class and the gateway's incoming content-type handling. Trace how multipart requests are accepted and forwarded to subgraphs, including the graphql-upload middleware constraint and Managed Federation implications. Done means federation supports GraphQL Multipart Requests without rejecting the incoming content type or assuming a JSON body.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.