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

Unhandled Promise rejection: Promise.withResolvers is not a function #2301

Open
Congchuabongbong opened this issue Apr 17, 2024 · 10 comments
Open
Assignees
Labels
20 scheduled for version 20 Original topic solved - ticket contains followup The original problem has been solved. However, as discussions go, a new issue has been raised. Solved waiting for the user's answer

Comments

@Congchuabongbong
Copy link

I am installing and testing version ^20.0.0-alpha.1 and see the error as shown in the picture:
image_2024_04_17T08_29_24_951Z
image_2024_04_17T08_29_39_510Z

@stephanrauh
Copy link
Owner

Which browser are you using? According to https://caniuse.com/?search=promise.withResolvers, browser support should be pretty good - with the exception of Safari: only the latest version of Safari supports this method.
image

@stephanrauh stephanrauh self-assigned this Apr 17, 2024
@stephanrauh stephanrauh added considering it Maybe I'll implement this, maybe not. I haven't made up my mind yet. It's an interesting proposal! 20 scheduled for version 20 labels Apr 17, 2024
@Congchuabongbong
Copy link
Author

Currently I'm using Chrome!

@stephanrauh
Copy link
Owner

Yes, you're right - I was blind yesterday, I should have seen it from your screenshot. Which version are you using?

@Congchuabongbong
Copy link
Author

i'm using latest version! exactly it's 124.0.6367.61

@stephanrauh
Copy link
Owner

That's weird. Nonetheless, the withResolvers() function is fairly new, so it makes sense to check whether the browser supports it. I'm preparing a browser switch.

@Congchuabongbong
Copy link
Author

Ok, I hope you will find the cause and I will also try to find the cause

@stephanrauh
Copy link
Owner

The improvement is going to land with version 20.0.0-alpha.2.

@stephanrauh stephanrauh added Solved and removed considering it Maybe I'll implement this, maybe not. I haven't made up my mind yet. It's an interesting proposal! labels Apr 20, 2024
@stephanrauh
Copy link
Owner

Version 20.0.0-alpha.2 was buggy. It always used the ES5 version of the code. Version 20.0.0-alpha.3 uses a more clever approach.

@SimonKunz
Copy link

SimonKunz commented May 23, 2024

Hey @stephanrauh,

unfortunately we still have trouble with this on safari. We tested this on Safari 15.6, 16.5 and 17.4.

17.4 works, but both older Browsers don't work.

It seems like zoneJS is messing things up here. When zoneJS is monkey patching the browser apis it's also monkey patching the 'withResolvers'-Function. So the function is not undefined any more, but still throws the error when invoked.

Is there any chance to fix this?

Thank you!

@stephanrauh
Copy link
Owner

@SimonKunz That's nasty. We have to talk serious with zone.js! :)

Jokes aside, I'm sure there's a way to solve it, but I'd like to talk you into finding the solution yourself and send me a pull request or to describe what I need to modify. I believe it's a task you can manage, and it helps me to catch up with the work that piled up during my vacations.

Browser detection happens in a file called op-chaining-support.js. That's a very simple class that runs some test. If they pass, the flag window.ngxExtendedPdfViewerCanRunModernJSCode is set to true, and otherwise the file crashed, so the flag remains undefined. Maybe you manage to call the withResolvers() function to enforce the crash, or you find a different class/method/function that has been introduced after Safari 17.4.

@stephanrauh stephanrauh reopened this May 23, 2024
@stephanrauh stephanrauh added waiting for the user's answer Original topic solved - ticket contains followup The original problem has been solved. However, as discussions go, a new issue has been raised. labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
20 scheduled for version 20 Original topic solved - ticket contains followup The original problem has been solved. However, as discussions go, a new issue has been raised. Solved waiting for the user's answer
Projects
None yet
Development

No branches or pull requests

3 participants