question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: file is missing, Promise has not been resolved (sometimes)

See original GitHub issue

Hello,

Since upgrading from 8.0.2 to 11.0.0 (node 14), when uploading a file from iOS (tested on Safari, Chrome) or MacOS (tested on Safari, Chrome DOESN’T HAVE the bug), the file is sometimes missing as the Promise has not been resolved with its content.

I have now tested around 100 times on Chrome MacOS (100 worked), and around 100 times on Safari MacOS, Chrome iOS and Safari iOS (around 40 worked). When it did not work, the file is missing and only the promise and resolve keys are here.

I would gladly help you fix it if I can, would you have any idea where it may come from?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
shrodingerscommented, Dec 2, 2020

Hello, I’m one of the back-end developper that worked on the topic. We are currently using the version 11.0.0. We were using the syntax you suggest on node 12.xx, but since upgrading to node 14, we had to bump the version of graphql-upload as a dependency of apollo-server (as per this comment, so we upgraded to version 11.0.0, and the syntax you propose don’t work anymore for us. The object we have is a direct Upload object, instead of FileUpload, and has this shape: {resolve: ƒ, reject: ƒ, promise: Promise, file: {…}}, with file being a FileUpload object. So we had to access the underlying file property in order to have access to { filename, mimetype, createReadStream }. This worked in most of the cases, but we had to also await the underlying promise in order to be sure our file property is populated. Seems like if there was a step bypassed in the object construction in order to have a proper FileUpload object in the end. In the end, finally found the source of the issue, but can still be interesting for further investigation : After multiple tests, it appears this syntax works fine with graphql-upload version 9.0.0 but with version 11.0.0 there is an issue with the way apollo-server handles the upload, and we have access to a primitive Upload object instead of the final FileUpload one.

1reaction
adrienharnaycommented, Dec 2, 2020

Hey, sorry about the delay. It seems doing await image.promise does the trick and generates image.file (note: await file doesn’t work).

About your questions: I’m integrating a back-end which is using graphql-upload and don’t have all the info, but it seemed like the promise didn’t resolve (again, on the browsers which I mentioned, and not everytime - testing 10 times would guarantee I got the error at least once though).

I don’t have any idea about the busboy issue, sorry.

Please let me know if I can provide more info, or if this is just intended behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I'm just not getting ES6 "promises" - Stack Overflow
I was missing: 1) use of "spread()" vs. ".then()", 2) using "resolve" to pass results from one "thenable" function to the next (eliminating...
Read more >
Error handling with promises
Error handling with promises. Asynchronous actions may sometimes fail: in case of an error the corresponding promise becomes rejected.
Read more >
5 Easy Ways to Fix the "jQuery is Not Defined" Error - Kinsta
The "jQuery is not defined" error means a call for a specific jQuery that wasn't available when the website loaded. Here's how to...
Read more >
How to fix "The following module is missing from the file ...
Usually this indicates a problem with your site. It is not a major problem, but one which should ideally be fixed if possible....
Read more >
Get help with Windows activation errors - Microsoft Support
This article will help you troubleshoot and fix common activation errors in ... If the device is new and has never been activated,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found