Puppeteer: Request Interception is not enabled!
continue/abort/respond is called while request interception is disabled.
continue/abort/respond is called while request interception is disabled.
Error message
Request Interception is not enabled!
How this error happens
Observing a request does not pause it. Calling continue, abort or respond requires interception to have been enabled before that request starts.
The snippets use an open Chrome/CDP page named page.
const [request] = await Promise.all([
page.waitForRequest(() => true),
page.goto("https://example.com/"),
]);
await request.continue();
How to fix
Enable interception before navigation, then resolve each paused request.
await page.setRequestInterception(
true
);
page.on("request", async (request) => {
if (request.isInterceptResolutionHandled()) {
return;
}
await request.continue();
});
await page.goto(
"https://example.com/"
);
Things to keep in mind
A listener that only reads request details does not need interception. Enabling it without resolving requests will stall the page.