Ngx-extended-pdf-viewer: TypeError: Promise.allSettled is not a function

Created on 15 Apr 2020  Â·  7Comments  Â·  Source: stephanrauh/ngx-extended-pdf-viewer

Check this first

Describe the bug
After loading the pdf file in ngx-extended-pdf-viewer it's showing an error in the console like TypeError: Promise.allSettled is not a function

Version info

  • Version of ngx-extended-pdf-viewer - 3.0.0.
  • Version of the JavaScript files pdf.js, pdf-worker.js and viewer.js (currently: default files vs. version 2.2 preview files) - I have just added the scripts in angular.json.
    "scripts": [
    "node_modules/ngx-extended-pdf-viewer/assets/pdf.js",
    "node_modules/ngx-extended-pdf-viewer/assets/viewer.js",
    "node_modules/ngx-extended-pdf-viewer/assets/pdf.worker.js" ]

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari] - Chrome
  • Version [e.g. 22]

To Reproduce
Can you provide a reproducer? That's a small and simple but complete project demonstrating the bug.

Otherwise, please tell me how to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Demo PDF file
Many errors happen with specific PDF files only. So please add a PDF file (after checking the copyright of the PDF file first!)

Screenshots
If applicable, add screenshots to help explain your problem.
IMG_20200413_223128

Additional context
Add any other context about the problem here.

Confirmed Solved user support

Most helpful comment

Please update to a current version of zone.js. The old versions of zone.js are like a polyfill, just the other way round: they wrap functions like Promise in order to add additional features. Too bad it took some time to support the full range of modern ES2015 methods.

So all you need to do is to update to a modern version of zone.js. When I did that, the update went flawlessly.

All 7 comments

Please update to a current version of zone.js. The old versions of zone.js are like a polyfill, just the other way round: they wrap functions like Promise in order to add additional features. Too bad it took some time to support the full range of modern ES2015 methods.

So all you need to do is to update to a modern version of zone.js. When I did that, the update went flawlessly.

stephan is right ! Also npm update zone.js won't update zone.js to the most recent version. You actually have to specify a version name npm update [email protected]

Still having a problem with ng2-pdf-viewer. I get this error when I upload pdfs:

pdf.js:7221 Uncaught (in promise) TypeError: Promise.allSettled is not a function
at MessageHandler._deleteStreamController (pdf.js:7221)
at MessageHandler._processStreamMessage (pdf.js:7160)
at Worker.MessageHandler._onComObjOnMessage (pdf.js:6817)
at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:4736)
at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at ZoneTask../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:498)
at invokeTask (zone.js:1744)
at Worker.globalZoneAwareCallback (zone.js:1781)

@jasonmonroe Did you add the polyfills? In particular, did you update to zone.js 10.x?

By the way, if you're interested in ng2-pdf-viewer, this is the wrong bugtracker. :)

I gave up and removed it. Decided to use the HTML5 tag instead. :(

On Wed, Jul 1, 2020 at 1:54 PM Stephan Rauh notifications@github.com
wrote:

@jasonmonroe https://github.com/jasonmonroe Did you add the polyfills?
In particular, did you update to zone.js 10.x?

By the way, if you're interested in ng2-pdf-viewer, this is the wrong
bugtracker. :)

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/stephanrauh/ngx-extended-pdf-viewer/issues/263#issuecomment-652590098,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AANF52TMBIQC7L33RQ55TXDRZOA7VANCNFSM4MIUP6ZA
.

In order to solveFailed to load PDF file,
d8b3f6df016c502832dfbe6db5d4b92
I added pdfjs.GlobalWorkerOptions.workerSrc = https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;

I have tried npm update [email protected] , but it is still wrong
f3c4538a0893190a946c296f91c7373

@hengqu4 This looks like Google Chrome. You say you're already using zone.js 0.10.3? Strange.

You can try to use the es5 versions of the files (i.e. pdf-es5.min.js, pdf.worker-es5.min.js, and viewer-es5.min.js.

BTW, if you're using ngx-extended-pdf-viewer, it's a bad idea to use the original pdf.js files from Cloudflare. I've modified the files from Mozilla, so you'll miss a couple of bug fixes and new features.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ekselys picture ekselys  Â·  5Comments

vfabregat picture vfabregat  Â·  5Comments

Avejack picture Avejack  Â·  4Comments

Dev-Akshay-Shelke picture Dev-Akshay-Shelke  Â·  10Comments

StevenGarcia-CG picture StevenGarcia-CG  Â·  10Comments