Back to Community

Fixing the 'Setting Up Fake Worker Failed' Error in PDF Embedder

19 threads Sep 10, 2025 PluginPdf embedder

Content

If you use the PDF Embedder plugin on your WordPress site, you may have encountered a frustrating error message that prevents your PDFs from displaying. The error typically reads: "Setting up fake worker failed", followed by a variation of one of these messages:

  • "Cannot read property 'WorkerMessageHandler' of undefined"
  • "Cannot load script at: [URL to a .worker.js file]"
  • "undefined is not an object"

This is a common issue reported by many users, and the good news is that it is almost always solvable. Based on community reports and solutions, this article explains why the error occurs and provides the most effective troubleshooting steps.

Why Does This Error Happen?

Overwhelmingly, this error is not a bug in the PDF Embedder plugin itself but a conflict with caching, optimization, or Content Delivery Network (CDN) tools on your website.

PDF Embedder relies on specific JavaScript files to render PDFs. When caching plugins or server-level optimizations (like LiteSpeed Cache, WP Rocket, Autoptimize, or Cloudflare) are active, they often try to combine, minify, or change the location of these scripts. This process can break the critical link between the main PDF viewer script and its "worker" script, leading to the error.

How to Fix the "Fake Worker" Error

Follow these steps to resolve the conflict. Always clear all relevant caches after making any changes.

Step 1: Update and Verify

First, ensure you are using the latest version of the PDF Embedder plugin. An outdated version might have known conflicts that have since been patched.

Step 2: Adjust Caching Plugin Settings (Most Common Solution)

You typically do not need to completely exclude PDF Embedder's scripts from caching. Instead, the key is to disable JavaScript aggregation or combination specifically for inline scripts.

  • In your caching plugin's settings (e.g., WP Rocket, LiteSpeed Cache, Autoptimize), look for options with names like:
    • Aggregate Inline JS
    • Combine JavaScript Files
    • Enable JavaScript Compression
  • Disable these options, save your settings, and then clear your site's cache completely.

This single change resolves the issue for the vast majority of users.

Step 3: Check for Server-Level Caching (PageSpeed Module)

If you don't have a caching plugin but still see this error, your web host might be using server-level caching like the Google PageSpeed Module.

  • Contact your hosting provider and ask them to disable the "Combine JavaScript" option in the PageSpeed module settings.
  • Alternatively, they can add the line ModPagespeedJsPreserveURLs on to your server configuration.

Step 4: Configure CDN Settings (CORS)

If you use a CDN like Cloudflare to serve your PDFs, you may need to configure Cross-Origin Resource Sharing (CORS) policies to allow the PDFs to be embedded properly. Consult your CDN's documentation on setting up CORS headers.

Step 5: Clear All Caches

After applying any of the fixes above, it is crucial to clear every cache involved:

  1. Clear your WordPress caching plugin's cache.
  2. Clear your browser's cache (or test in a private/incognito window).
  3. If you use a CDN, clear its cache as well.

What If the Error Persists?

If you have tried all the steps above and are still seeing the error, try these final checks:

  • Temporarily disable caching: Turn off your caching/optimization plugin entirely to confirm it is the source of the conflict. If the PDFs load, you know the issue is in that plugin's configuration.
  • Check for conflicts: Briefly switch to a default WordPress theme (like Twenty Twenty-Four) and disable all other plugins except PDF Embedder to rule out a less common conflict with another tool.

By methodically working through these common causes, you should be able to resolve the "Setting up fake worker failed" error and get your PDFs displaying correctly for all your visitors.

Related Support Threads Support