【问题标题】:Apollo federation file upload阿波罗联盟文件上传
【发布时间】:2021-10-21 07:21:57
【问题描述】:

我在 apollo 联邦子图中上传文件时遇到问题,这是我在 apollo 网关中的代码

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,
})

在使用来自@apollo/gateway 的 RemoteGraphQLDataSource 时,这是文件上传的结果

错误是 BadRequestError: Missing multipart field ‘operations’。

但是当我从服务列表中引导请求时,文件被上传 在搜索它时,我找到了这个解决方案 https://www.npmjs.com/package/@profusion/apollo-federation-upload 然后将 RemoteGraphQLDataSource 替换为 FileUploadDataSource 但输出相同

有人可以帮我解决这个问题吗?谢谢

【问题讨论】:

    标签: express graphql apollo apollo-server apollo-federation


    【解决方案1】:

    我通过设置uploads:false 来解决它,因为我在此设置中使用的是阿波罗 2

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

    【讨论】:

      猜你喜欢
      • 2021-12-28
      • 2019-12-09
      • 2021-01-05
      • 2020-07-17
      • 2022-01-21
      • 2021-09-09
      • 2021-06-01
      • 2018-09-09
      • 2013-02-02
      相关资源
      最近更新 更多