-
Notifications
You must be signed in to change notification settings - Fork 104
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
Unhandled promise: Protocol Error #45
Comments
Do you use |
I use custom setRequestInterception in my code, and i have this problem. await cluster.task(async ({ page, data: url }) => {
const proxyAddress = utils.getProxy( );
await useProxy( page, proxyAddress );
// await page.setRequestInterception( true );
page.on('request', async request => {
let requestBlocked = false;
const reqDomain = new URL( request.url() ).host;
if ( domainsBL ) {
if ( domainsBL.includes( reqDomain ) ) {
console.log('Block and crash :(');
request.abort();
requestBlocked = true;
}
}
});
}); output: chapov@WIN-KF7HQ5BAFTM:/opt/my/zen$ npm run scrapper
> [email protected] scrapper /opt/my/zen
> nodemon scrapper.js --exec babel-node
[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `babel-node scrapper.js`
queued task
Block and crach :(
(node:23058) UnhandledPromiseRejectionWarning: Error: Request is already handled!
at Object.exports.assert (/opt/my/zen/node_modules/puppeteer/lib/cjs/puppeteer/common/assert.js:26:15)
at HTTPRequest.abort (/opt/my/zen/node_modules/puppeteer/lib/cjs/puppeteer/common/HTTPRequest.js:317:21)
at requestHandler (/opt/my/zen/node_modules/puppeteer-page-proxy/src/core/proxy.js:41:23)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:23058) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:23058) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^C how can I get around this? Need to use a proxy for the per page, not for per requests |
@chapov I think you forgot about request.continue() after if statement. |
oh, I wrote in the wrong place, here is another topic... @birdkiwi not, everything falls to request.abort (), stacktrace refers to: request.abort() |
When loading multiples pages at once I get this unhandled promise
[email protected]
[email protected]
[email protected]
The text was updated successfully, but these errors were encountered: