(Created on )

Puppeteer: WebWorker.close() is not supported

The selected worker implementation does not support WebWorker.close.


The selected worker implementation does not support WebWorker.close.

Error message

WebWorker.close() is not supported

How this error happens

Not every worker implementation supports WebWorker.close. Calling that method on an unsupported worker does not terminate it.

The failing snippet assumes page owns a worker whose Puppeteer implementation does not support close.

const worker = page.workers()[0];

await worker.close();

How to fix

If the application created the dedicated worker, terminate it through the owning page’s Worker object. This demo exposes that object as window.taskWorker.

await page.evaluate(() => {
    if (window.taskWorker) {
        window.taskWorker.terminate();
    }
});

Things to keep in mind

The application must retain its actual Worker instance for this fix. A service worker has a different lifecycle; unregistering it is not the same as terminating a dedicated worker. Do not close unrelated workers.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →