(Created on )

Puppeteer: Unable to serializable {value}

BiDi argument serialization receives a function or symbol value it cannot encode.


BiDi argument serialization receives a function or symbol value it cannot encode.

Error message

Unable to serializable {value}

{value} is replaced by the value shown in your error message.

How this error happens

A function or symbol cannot be sent as an ordinary WebDriver BiDi argument. This example tries to transfer a Node.js callback into the page.

The snippets use a WebDriver BiDi page named page.

await page.evaluate(
    (callback) => callback(),
    () => "dark"
);

How to fix

Put executable logic in the evaluated callback and pass only serializable data as arguments.

const theme = await page.evaluate(
    (value) => {
        return value;
    },
    "dark"
);

console.log(theme);

Things to keep in mind

Use page.exposeFunction when the browser intentionally needs to call a Node.js function. Passing that function as an argument does not expose it.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →