Closed FarhadMohseni closed 2 years ago
I'm also facing this issue and a similar one and from what I can tell debugging, the issue seems to occur when a frame is embedded in the page which is "about:blank" or empty.
From what I know, things like AdWords creates dynamic frames which have no URL associated with them, this I assume calls Chrome to default to "about:blank". It seems to be related to #36
What seems to happen is that in requestHandler
of proxy.js, it validates that request.url()
starts with a proper value, it then continues and passes that to CookieHandler
, it doesn't check request.isNavigationRequest()
CookieHandler has this line
this.url = request.isNavigationRequest() ? request.url() : request.frame().url();
If isNavigationRequest()
returns false
then it takes request.frame().url()
which in the case of AdWords seems to return 'about:blank'.
this gets passed to the next line
this.domain = new URL(this.url).hostname;
Where the error is then thrown.
Maybe I've completely missed the boat, I've not spent a massive amount of time on this yet so maybe I'm wrong.
I'm also facing this issue and a similar one and from what I can tell debugging, the issue seems to occur when a frame is embedded in the page which is "about:blank" or empty.
From what I know, things like AdWords creates dynamic frames which have no URL associated with them, this I assume calls Chrome to default to "about:blank". It seems to be related to #36
What seems to happen is that in
requestHandler
of proxy.js, it validates thatrequest.url()
starts with a proper value, it then continues and passes that toCookieHandler
, it doesn't checkrequest.isNavigationRequest()
CookieHandler has this line
this.url = request.isNavigationRequest() ? request.url() : request.frame().url();
If
isNavigationRequest()
returnsfalse
then it takesrequest.frame().url()
which in the case of AdWords seems to return 'about:blank'.this gets passed to the next line
this.domain = new URL(this.url).hostname;
Where the error is then thrown.
Maybe I've completely missed the boat, I've not spent a massive amount of time on this yet so maybe I'm wrong.
This seems to be a right thing, it also happens on Twitter Any idea how to fix it yet?
@Somberor
I forked the branches and modified proxy.js
You can see it here
https://github.com/undefinedfunction/puppeteer-page-proxy/blob/master/src/core/proxy.js
I didn't do a PR because I wasn't entirely confident I'd figured the issue but the above did seem to work for me
@undefinedfunction sadly the solution didn't work for me , it doesn't give error but some functions on twitter doesn't work that way :/
fixed in v1.2.9
when i want to use the proxy on page with :
i'm getting this error:
puppeteer version : 5.2.1 using puppeteer-extra with the stealth plugin