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

[puppeteer-extra-plugin-block-resources] Error: Request is already handled! #156

Closed
ghost opened this issue Feb 19, 2020 · 14 comments
Closed

Comments

@ghost
Copy link

ghost commented Feb 19, 2020

This is similar to issue #90 and #91 but is occured sporadically with this being the only plugin enabled and no other request interception exists in the code.

Unfortunately, I'm not allowed to post the code that's running but it's scraping a terribly designed web page with a few dozen iframes that continuously change as the code loops through them. The iframes also use the same resources.

I could be wrong, but I believe this error is occuring because the onRequest function is called multiple times for such "duplicate" resources even though they were handled once before. Regardless, I'm thinking that a solution would be to check if the request has been handled before request.continue() or request.abort() is called, as puppeteer does in the code below.

https://github.com/puppeteer/puppeteer/blob/c2651c2b5cc888ebd0ca6be87063d9f98b9eb59c/lib/NetworkManager.js#L456

assert(!this._interceptionHandled, 'Request is already handled!');
@ghost
Copy link
Author

ghost commented Feb 19, 2020

Pull request: #157

@liamcharmer
Copy link

Is this really solved?

@ghost
Copy link
Author

ghost commented May 28, 2020

I did this manually and it solved it for me. Doesn't seem to be merged in with the master.

@liamcharmer
Copy link

What can i do then to avoid this?? 🌊

@benallfree
Copy link

FYI I have a Puppeteer PR in to solve this puppeteer/puppeteer#6733

@seth100
Copy link

seth100 commented Jan 8, 2021

FYI I have a Puppeteer PR in to solve this puppeteer/puppeteer#6733

I hope they will accept it as soon as possible!

@benallfree
Copy link

@seth100 Try the package I just published https://www.npmjs.com/package/enchant-puppeteer

@seth100
Copy link

seth100 commented Jan 9, 2021

@seth100 Try the package I just published https://www.npmjs.com/package/enchant-puppeteer

thanks @benallfree, but trying to install that I get 404

@benallfree
Copy link

@seth100 My fault, fixed in 0.0.2. Please install again: npm i enchant-puppeteer@latest.

@seth100
Copy link

seth100 commented Jan 9, 2021

@benallfree it works great! No error no more! Thank you

@benallfree
Copy link

@seth100 Awesome, please head over to my repo if you have any other issues. When @berstend sees this maybe I can talk to him about integrating it into puppeteer-extra 👍

@seth100
Copy link

seth100 commented Jan 10, 2021

@benallfree thanks, yes I hope it will be integrated into puppeteer-extra too!

@berstend
Copy link
Owner

Seems like the puppeteer maintainers are open to merge this in: puppeteer/puppeteer#6735 (comment)

In case they end up not patching this upstream we can incorporate the changes in puppeteer-extra as well.

@seth100
Copy link

seth100 commented Jan 13, 2021

Seems like the puppeteer maintainers are open to merge this in: puppeteer/puppeteer#6735 (comment)

In case they end up not patching this upstream we can incorporate the changes in puppeteer-extra as well.

great news, I'll stay tuned for that!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants