Search code examples
expressgraphqlapolloapollo-serverapollo-federation

Apollo federation file upload


I have a problem in uploading file in apollo federation subgraph, this is my code in apollo gateway

import {
ApolloGateway,
// RemoteGraphQLDataSource //replace by FileUploadDataSource from @profusion/apollo-federation-upload for file upload
} from '@apollo/gateway'
import FileUploadDataSource from '@profusion/apollo-federation-upload'
const gateway = new ApolloGateway({ //RemoteGraphQLDataSource 
   serviceList, //port:4010
   buildService: ({ url }) => new FileUploadDataSource({ 
   url, useChunkedTransfer: true }),
   useChunkedTransfer: true,
})

In using RemoteGraphQLDataSource from @apollo/gateway this the result of file upload enter image description here

the error is BadRequestError: Missing multipart field ‘operations’.

but when I am directing the request from the service list, the file is uploaded enter image description here upon searching for it I find this solution https://www.npmjs.com/package/@profusion/apollo-federation-upload then replace RemoteGraphQLDataSource to FileUploadDataSource but the output is the same

can anybody help me about this? thank you


Solution

  • I solve it by setting uploads:false since I am using apollo 2 in this set up

    https://github.com/profusion/apollo-federation-file-upload/issues/35