vue-pdf icon indicating copy to clipboard operation
vue-pdf copied to clipboard

Uncaught (in promise) DataCloneError: Failed to execute 'postMessage' on 'Worker'

Open anzemur opened this issue 11 months ago • 2 comments

I am using Nuxt 3 with vue-pdf, and everything works as it should (I have it wrapped in the client-only component, and displaying the pdf and working with annotations works). The problem occurs when I try to call any function exposed in the vue-pdf composable, like print()or download(). The error I get seems to originate from pdfjs-dist:

Uncaught (in promise) DataCloneError: Failed to execute 'postMessage' on 'Worker': #<Object> could not be cloned.
    at MessageHandler.sendWithPromise (@tato30_vue-pdf.js?v=3690f757:8805:19)
    at WorkerTransport.saveDocument (@tato30_vue-pdf.js?v=3690f757:12765:32)
    at PDFDocumentProxy.saveDocument (@tato30_vue-pdf.js?v=3690f757:11595:28)
    at M (@tato30_vue-pdf.js?v=3690f757:22403:57)
    at doSomething (PdfViewer.vue:24:11)
    at callWithErrorHandling (runtime-core.esm-bundler.js?v=3690f757:197:19)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js?v=3690f757:204:17)
    at HTMLDivElement.invoker (runtime-dom.esm-bundler.js?v=3690f757:713:5)

Additional context

  • vue-pdf: [1.11.3]
  • vue: [3.5.13]
  • nuxt: [3.15.1]

anzemur avatar Jan 22 '25 08:01 anzemur

@TaTo30 I have also seen this issue using a plain Vue 3 project. Do you have any ideas on where to look for this issue?

vordimous avatar Feb 25 '25 13:02 vordimous

I tried to reproduce this error using both plain Vue 3 and Nuxt but I did not get any issues, both methods works well.

The error I get seems to originate from pdfjs-dist

Yeah the error comes from pdfjs-dist but searching similar issues on pdf.js repo it seems that this error is more related on frameworks changing the Promise object (check: https://github.com/mozilla/pdf.js/issues/9840)

Please share a reproducible code so we can figure out what is the issue.

TaTo30 avatar Mar 21 '25 04:03 TaTo30