Closed paulbijancoch closed 1 year ago
I did use it with apollo server v3 and federation and it worked well. Unfortunately it seemed to stop working after upgrading the server to v4 (some issues with CSRF, I am still investigating). I consider dumping graphql-upload and switching to REST upload as this package no longer fills my needs and also stopped supporting CommonJS imports (require) from v16 onwards. Anyway if You are interested, there are few things you should do:
const gateway = new ApolloGateway({ // supergraphSdl: sdlContent, supergraphSdl: new IntrospectAndCompose({ subgraphs: serviceList, }), buildService({ name, url }) { return new FileUploadDataSource({ url, useChunkedTransfer: true, }); }, }); ......... const server = new ApolloServer({ gateway, includeStacktraceInErrorResponses: true, }); `
`const { graphqlUploadExpress } = require('graphql-upload');
app.use(graphqlUploadExpress());`
`import { createUploadLink } from 'apollo-upload-client';
const uploadLink = createUploadLink({
uri: ${process.env.REACT_APP_BACKEND_URL}/graphql
,
// credentials: 'include',
});
const client = new ApolloClient({ // credentials: 'include', cache: new InMemoryCache({ addTypename: false, }), link: ApolloLink.from([some_other_links, uploadLink]), }); `
I hope it was what you were asking for.
Closing because this is a question better asked of Apollo, since it concerns their products and services. Anyone knowledgeable about the topic is still welcome to answer the original question here though and share their insights.
hey @dominik-myszkowski and thank you very much for your solution. Did you use that with typescript? because when I do so, i get an error, that the graphql-upload's package.json does not have any "exports" main defined. I'd be thankful for any thought on this.
best, Paul
@paulbijancoch see the documented requirements for TypeScript:
https://github.com/jaydenseric/graphql-upload/tree/v16.0.2#requirements
Also, make sure you are deep importing as the exports are documented:
https://github.com/jaydenseric/graphql-upload/tree/v16.0.2#exports
@jaydenseric unfortunately this is meant to be in the @profusion/apollo-federation-upload
package. I already mentioned my bug in their repository, see https://github.com/profusion/apollo-federation-file-upload/issues/62.
But thank you for your kind advice
Hey everyone,
we started to implement the great graphql-upload package in our current project. But we wanted to make use of the new Apollo Federation 2 Supergraphs & Subgraphs. Does anyone have any experience with that or any ideas on how to implement it?
Best wishes,
Paul