Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(node:2323) UnhandledPromiseRejectionWarning: Error: Request Interception is not enabled! #3811

Closed
hongdaliu opened this issue Jan 19, 2019 · 8 comments

Comments

@hongdaliu
Copy link

await page.setRequestInterception(true)

@huan
Copy link

huan commented Jun 16, 2019

This issue is definitely a time saver!

@DevYuns
Copy link

DevYuns commented Jul 22, 2020

I also have trouble with page.setRequestInterception(true). any other progress?

@christian-bromann
Copy link
Contributor

@DevYuns can you provide a reproducible example?

@john-doherty
Copy link

john-doherty commented Dec 31, 2020

@christian-bromann here's a reproducible example:

// launch the browser
var browser = await puppeteer.launch({ headless: false });

// get existing tab/page (first item in the array)
var [page] = await browser.pages();

// inspect each request and blocking external resources
page.on('request', function(req) {

    var resourceUrl = url.parse(req.url());
    var resourceHost = resourceUrl.host;
    var blockedResources = ['google-analytics.com'];

    if (blockedResources.indexOf(resourceHost) > -1) {
        req.abort();
    } else {
        req.continue();
    }
});

// load barcode tracking website
await page.goto('https://orcascan.com');

Result = Error: Request Interception is not enabled!

If you add await page.setRequestInterception(true); it works, but it's not obvious - especially to new users.

Ideally, it should activate itself whenever the request event is subscribed to.

@albanx
Copy link

albanx commented Sep 6, 2021

For some reason this is breaking in my code as well. What is strange is that in some macchine it fails in some other it passes. I have enabled the setRequestInterception. Must be failing in some specific versions of pupuppeteer

@TryingToImprove
Copy link

I had this issue with v10. Just upgraded to v13 of the node library and it seems to be working now..

@stale
Copy link

stale bot commented Jun 23, 2022

We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.

@stale stale bot added the unconfirmed label Jun 23, 2022
@stale
Copy link

stale bot commented Jul 23, 2022

We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!

@stale stale bot closed this as completed Jul 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants