Puppeteer: BiDi only allows domain partition keys
The BiDi cookie conversion accepts a string domain partition key, not an unsupported key shape.
The BiDi cookie conversion accepts a string domain partition key, not an unsupported key shape.
Error message
BiDi only allows domain partition keys
How this error happens
The BiDi Page.setCookie conversion in this path only accepts a string partition key. Passing a composite CDP-style object fails its shape check.
The snippets use a WebDriver BiDi page named page.
await page.setCookie({
name: "preference",
value: "dark",
url: "https://example.com",
partitionKey: {
sourceOrigin: "https://example.com",
hasCrossSiteAncestor: false,
},
});
How to fix
Use a string key if a top-level-site-only partition is appropriate for your task.
await page.setCookie({
name: "preference",
value: "dark",
url: "https://example.com",
partitionKey: "https://example.com",
});
Things to keep in mind
This is not an equivalent replacement for a composite key with a cross-site-ancestor requirement. Use a browser/protocol path that supports that requirement instead of dropping cookie isolation.