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

xhr-upload retry upload bundle throws "error uncaught in promise" on html only site #3204

Closed
BePo65 opened this issue Sep 20, 2021 · 6 comments
Assignees

Comments

@BePo65
Copy link
Contributor

BePo65 commented Sep 20, 2021

As a follow up to issue #1977 I created a small demo using uppy 2.1.0 with xhrupload in a pure html application in stackblitz.

Even when I use uppy without angular I get the following error in the console:
Uncaught (in promise) Error: This looks like ....

Even though the site doesn't break, I am convinced that there should not be any uncaught errors in a promise.

To be a good contributor, I was trying to find the line that finally caused the error, but unluckily I failed to trace the error down.

In core/index.js in the function _runUpload2 it says:

// Not returning the catched promise, because we still want to return a rejected
// promise from this method if the upload failed.

But I didn't find the line where the error is finally catch`ed. If you could give a few hints about the code structure, I will try to find a solution to this little problem.

@aduh95
Copy link
Contributor

aduh95 commented Sep 20, 2021

I think this is supposed to have been fixed by #3197: we noticed this error on an other package, but the problem was actually in @uppy/core so it's probably related to the failure you see. Can you try to upgrade up @uppy/core 2.0.3 (released earlier today) and let me know if that fixes it.

@aduh95 aduh95 self-assigned this Sep 20, 2021
@BePo65
Copy link
Contributor Author

BePo65 commented Sep 21, 2021

Thanks for the tipp; I tried it with the bundled version (v2.1.1) in my stackblitz demo.
Unluckily the error still exists:
uppy-2 1 1-xhrupload-error

@Murderlon
Copy link
Member

This doesn't seem to be an issue anymore on the latest bundle. Assuming it is fixed. Feel free to reopen if otherwise

https://codesandbox.io/s/funny-bassi-ed1bv?file=/index.html

@BePo65
Copy link
Contributor Author

BePo65 commented Oct 26, 2021

I still have the error, when using uppy in an angular project. I updated my example on stackblitz to use the latest version of angular, but this doesn't change the error shown in the console:

So I tried to reproduce the error in a 'html only' configuration by catching uncatched errors (see this stackblitz demo).
But no error message from one of my console.log commands shows up.

What worries me a little bit is the fact thateven though we get a error reported in the console, the error handler of uppy is not called - shouldn't it?

[Uppy] [11:12:32] Failed to upload 2019-01-16_001_Berge.jpg
This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.

And as an aside: npm shows V2.2.1 for uppy but e.g. @uppy/dashboard is still on V2.1.1 - is this ok?

@Murderlon
Copy link
Member

There is no uncaught promise rejection error, which is what the issue is about, as can be seen from my previously shared codesandbox based on your example.

It is of course expected you'll see an network error if you are using https://google.com as the endpoint. Lastly, I can see the this.uppy.on('error') is in fact called.

Is there a particular problem you are experiencing or is it just logs?

@BePo65
Copy link
Contributor Author

BePo65 commented Oct 29, 2021

The 'uncaught promise rejection error' is only thrown when using uppy in an angular app - so angular (the npm zone package?) seems to have some secret mechanism to watch promises (just kidding).
I was trying to reproduce this in a plain html scenario in my stackblitz example, but without success.
As this doesn't influence the functionality of my app, let's forget about it.

Concerning your second point:
Of course my stackblitz example has a network error if I try to upload to google.com. I wanted to have such an error to test the retry function. And so does your codesandbox example.

But if you state:

Lastly, I can see the this.uppy.on('error') is in fact called.

Shouldn't the code in the fragment

  uppy.on("error", (error) => {
    console.log("Uppy-Error ********************");
  });

log Uppy-Error ******************** to the console; even in the codesandbox example (which it does not - at least not on my computer)?

Thank you for your patience :-)

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

No branches or pull requests

3 participants