You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I load a page in a loop, creating a new page each time and saving a screenshot as a result. After a few iterations, an exception is raised and not handled because of a malformed URI.
I tried to print all the url that are requested and I see some stuff like:
'use strict';constpuppeteer=require('puppeteer');(async()=>{process.on("unhandledRejection",(reason,p)=>{console.error("Unhandled Rejection at: Promise",p,"reason:",reason);// application specific logging, throwing an error, or other logic herecont=false;});constargs=["--disable-gpu","--disable-setuid-sandbox","--force-device-scale-factor","--ignore-certificate-errors","--no-sandbox",];constoptions={
args,headless: true,ignoreHTTPSErrors: true,};constbrowser=awaitpuppeteer.launch(options);letcont=true;letn=0while(cont){console.log(n);n++try{constpage=awaitbrowser.newPage();awaitpage.setRequestInterceptionEnabled(true);page.on("request",(request)=>{if(request.resourceType==="Image"){request.abort();}else{request.continue();}});awaitpage.goto('http://www.smh.com.au/rugby-league/league-news/the-year-in-discord-part-i-20140105-30bhz.html');awaitpage.screenshot({path: 'example.png'});awaitpage.close();}catch(error){console.error("exception",error);}}awaitbrowser.close();})();
save this file as minimal.js
run nodejs minimal.js
wait...
relaunch after some time if it doesn't crash
What is the expected result?
The program should run forever
What happens instead?
Note that the number of successful loop before to get the error is not always the same. I guess that it depends on the behavior of the website.
$ nodejs src/minimal.js
0
1
2
3
Unhandled Rejection at: Promise Promise {
<rejected> URIError: URI malformed
at decodeURI (<anonymous>)
at generateRequestHash (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/NetworkManager.js:399:10)
at NetworkManager._onRequestIntercepted (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/NetworkManager.js:139:25)
at emitOne (events.js:115:13)
at Session.emit (events.js:210:7)
at Session._onMessage (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/Connection.js:199:12)
at Connection._onMessage (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/Connection.js:98:19)
at emitOne (events.js:115:13)
at WebSocket.emit (events.js:210:7)
at Receiver._receiver.onmessage (/home/louis/Code/test/v2/test_server/node_modules/ws/lib/WebSocket.js:143:47) } reason: URIError: URI malformed
at decodeURI (<anonymous>)
at generateRequestHash (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/NetworkManager.js:399:10)
at NetworkManager._onRequestIntercepted (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/NetworkManager.js:139:25)
at emitOne (events.js:115:13)
at Session.emit (events.js:210:7)
at Session._onMessage (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/Connection.js:199:12)
at Connection._onMessage (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/Connection.js:98:19)
at emitOne (events.js:115:13)
at WebSocket.emit (events.js:210:7)
at Receiver._receiver.onmessage (/home/louis/Code/test/v2/test_server/node_modules/ws/lib/WebSocket.js:143:47)
Unhandled Rejection at: Promise Promise {
<rejected> URIError: URI malformed
at decodeURI (<anonymous>)
at generateRequestHash (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/NetworkManager.js:399:10)
at NetworkManager._onRequestWillBeSent (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/NetworkManager.js:181:27)
at emitOne (events.js:115:13)
at Session.emit (events.js:210:7)
at Session._onMessage (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/Connection.js:199:12)
at Connection._onMessage (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/Connection.js:98:19)
at emitOne (events.js:115:13)
at WebSocket.emit (events.js:210:7)
at Receiver._receiver.onmessage (/home/louis/Code/test/v2/test_server/node_modules/ws/lib/WebSocket.js:143:47) } reason: URIError: URI malformed
at decodeURI (<anonymous>)
at generateRequestHash (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/NetworkManager.js:399:10)
at NetworkManager._onRequestWillBeSent (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/NetworkManager.js:181:27)
at emitOne (events.js:115:13)
at Session.emit (events.js:210:7)
at Session._onMessage (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/Connection.js:199:12)
at Connection._onMessage (/home/louis/Code/test/v2/test_server/node_modules/puppeteer/lib/Connection.js:98:19)
at emitOne (events.js:115:13)
at WebSocket.emit (events.js:210:7)
at Receiver._receiver.onmessage (/home/louis/Code/test/v2/test_server/node_modules/ws/lib/WebSocket.js:143:47)
The text was updated successfully, but these errors were encountered:
I tried the patch from #668 and I can't reproduce the error anymore with it. So I really think that it is required to sanitize (automatically or with a hook?) the urls that are requested from the pages that are navigated to.
I have an issue that I think is related to #668
I load a page in a loop, creating a new page each time and saving a screenshot as a result. After a few iterations, an exception is raised and not handled because of a malformed URI.
I tried to print all the url that are requested and I see some stuff like:
I wonder if it could be the source of the problem.
Steps to reproduce
Tell us about your environment:
What steps will reproduce the problem?
nodejs minimal.js
What is the expected result?
The program should run forever
What happens instead?
Note that the number of successful loop before to get the error is not always the same. I guess that it depends on the behavior of the website.
The text was updated successfully, but these errors were encountered: