Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileMissingUploadError: File missing in the request #47

Closed
smithaitufe opened this issue Feb 16, 2018 · 8 comments
Closed

FileMissingUploadError: File missing in the request #47

smithaitufe opened this issue Feb 16, 2018 · 8 comments

Comments

@smithaitufe
Copy link

Please how do we make FileUpload optional?

@jaydenseric
Copy link
Owner

Could you please provide example for how to reproduce that error?

Here is an answer for someone else asking a somewhat related question.

@jaydenseric
Copy link
Owner

jaydenseric commented Feb 21, 2018

FileMissingUploadError should only happen if the multipart request is malformed and does not match the spec. Something unlikely to happen if apollo-upload-client is forming the request.

If you meant the question in the basic GraphQL sense, you can make an Upload scalar optional by not putting a ! next to it.

@luciomr
Copy link

luciomr commented Oct 8, 2020

@jaydenseric the referenced answer did it for me. My Upload parameter was made optional by not adding the ! next to it, but I was still getting the error because in Postman I was still indicating in my multipart request that there was a file to be expected in the map line.
Leaving the value of map as an empty array ({"0": []}) and giving a value of null to the file parameter in the operations part of the form request fixed it for me.

@ehxxn
Copy link

ehxxn commented Oct 22, 2020

I have this issue with ReactNativeFile only in ios

@amosbastian
Copy link

@EhsanSarshar did you manage to solve it? I'm having the same problem 😓

@ehxxn
Copy link

ehxxn commented Apr 13, 2021

@amosbastian I think for me it was a bug in one version on react native. so after releasing a patch I just upgrade and the error gone.

@Dajust
Copy link

Dajust commented Jan 12, 2022

I had this problem in React Native (Android). The problem for my case happened when Android couldn't get the filename of the photo, so the name property in ReactNativeFile construction was undefined. My fix was to patch the name property like so:

  {
        uri: image.path,
        type: image.mime,
        name: image.filename || `${Date.now()}.${image.mime.split('/')[1]}`,
   }

Although the typing of ReactNativefile suggest that both the type and name property could be undefined, graphql-upload obviously doesn't like that.

@Yemisrach15
Copy link

I had this problem in React Native (Android). The problem for my case happened when Android couldn't get the filename of the photo, so the name property in ReactNativeFile construction was undefined. My fix was to patch the name property like so:

  {
        uri: image.path,
        type: image.mime,
        name: image.filename || `${Date.now()}.${image.mime.split('/')[1]}`,
   }

Although the typing of ReactNativefile suggest that both the type and name property could be undefined, graphql-upload obviously doesn't like that.

Thank you for this reallly. I was close to giving up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants