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

CompileError: WebAssembly.instantiate(): Refused to compile or instantiate WebAssembly module

Open RiccardoRiggi opened this issue 11 months ago • 10 comments

Good morning, since January 20, 2025 we have encountered a blocking bug that prevents the rendering of PDF files:

Uncaught (in promise) RuntimeError: Aborted(CompileError: WebAssembly.instantiate(): Refused to compile or instantiate WebAssembly module because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline'"). Build with -sASSERTIONS for more info.

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome not work (v. 131), Firefox at the moment yes
  • React-pdf version a lot, like (3.1.9, 3.1.2, 4.1.6, )

We would like to avoid changing CSP policies to protect our applications from xss vulnerabilities

Do you know how to help us? Thank you in advance

RiccardoRiggi avatar Jan 21 '25 10:01 RiccardoRiggi

How is it going?

leotankilevich avatar Feb 02 '25 23:02 leotankilevich

Same issue

didemkkaslan avatar Feb 04 '25 19:02 didemkkaslan

same

buzzo123 avatar Feb 05 '25 09:02 buzzo123

Same issue! Did anyone find any solution? Please help.

mayanksaxena avatar Feb 12 '25 09:02 mayanksaxena

Same issue here -- this seems prevalent across multiple projects. And has been opened multiple times on this repo: #2596 #510 #2815

Sorry for the direct tag but @diegomura any idea if there will be a legit fix to this problem? 🙏

etanb avatar Feb 12 '25 20:02 etanb

Hello, having the same issue, any updates on this?

keptaduona avatar May 07 '25 11:05 keptaduona

Same issue, any updates?

nistalhelmuth avatar Jun 03 '25 20:06 nistalhelmuth

still the same

hikitahero avatar Jun 19 '25 11:06 hikitahero

One thing that worked for me was upgrading @react-pdf/renderer to v4.3 (so that we can upgrade to React 19) but pinning @react-pdf/textkit to v4.2 and @react-pdf/layout to v3.6 (which were their respective versions for v3 of @react-pdf/renderer). The unsafe-eval is happening in one of those other packages' newer versions.

noahgrant avatar Aug 25 '25 15:08 noahgrant

+1

M-AhmedSajid avatar Oct 14 '25 15:10 M-AhmedSajid