Closed toscanov closed 3 years ago
I may have some additional information.
Running apollo-server, added graphql-upload supposedly this is already included, there's no documentation on how to add this via typescript only if you are using a graphql file. I did finally find the one throwing the error that was inside graphql-upload under apollo-server-core.
app.use(
graphqlUploadExpress()
);
The multipart request the client is sending looks ok to me at first glance, so chances are your problem is not the client.
Unfortunately Apollo Server's built in implementation of graphql-upload
uses a very outdated major version of graphql-upload
; there are a lot of issues in their repo about the frustrations this causes. They refuse to update the dependency because they are not yet ready to market an Apollo Server v3. Please completely disable their implementation of file uploads (you can find instructions in the Apollo Server issues) and do a fresh manual setup of the latest graphql-upload
version. If you have not already done this properly, you will for sure experience issues. Issues from the old graphql-version
that have since been fixed (e.g. support for recent Node.js versions), and issues from having multiple instances of graphql-upload
being used at once and conflicting with each other (if you attempted a manual installation without undoing the Apollo Server integration first).
If you manage to isolate a graphql-upload
bug in a correct setup, we can reopen and investigate further.
Thanks, I'll look into disabling their implementation. I'm testing my theory that they don't export the graphqlUploadExpress function which might be causing some problems as that's the only way to add the scalar upload when you're autogenerating the file.
they don't export the graphqlUploadExpress function which might be causing some problems as that's the only way to add the scalar upload when you're autogenerating the file
This confuses me. What file are you "autogenerating", the schema? The Express middleware is to process an incoming GraphQL multipart request; you don't need it if all you are doing is introspecting the schema to get types or something.
The actual Upload
scalar is available on it's own:
https://github.com/jaydenseric/graphql-upload#class-graphqlupload
Sorry, all the documentation basically says add "scalar Upload" to the schema, but you are correct I'm autogenerating the schema which is exhausting because of the utter lack of information out there. Without adding the middleware I haven't been able to determine how to add the scalar Upload to the schema being generated. I think once I get my code back to normal and disable their upload I might be okay.
And thank you for all this help, I appreciate the time you've given me.
Thank you again, It worked once I disabled their upload via the apollo config settings "uploads: false"
I know this is a common issues, and I've made sure the app is sending the right data. I've even added logging to show that the fields are being populated correctly.
The one thing I noticed is the console.log I have inside parser.once('finish' () => {}) wasn't being called, which is where the "Missing multipart field" error should be coming from. Any insight would be appreciated.
Client post has the following:
Server Typescript:
Client Typescript:
HTML: