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
Avoid modifying WSS URLs since parameters are dropped through the detectURL method #972
Comments
Hey folks -- wanted to bump this up as we're more than happy to implement the work, but just wanted to get quick consensus that the approach is right. Please do let us know your thoughts and PR should follow up! |
Hi @joelgriffith, thank you first! |
Hi @ZekeLu, thank you for your feedback! Thanks again for weighing in! |
any solution here? can't use browserless with token :) |
Hey @kotchuprik , until we finish up this change, the workaround for now is to "pin" chromedp to an older version... Anything prior to "v0.7.3" should work. Please let me know if this workaround works for you in the meantime. We've been working on a new product with browserless so we haven't got to working on this PR lately. We'll try to put in the time soon. Thanks for understanding. |
Bug description
Ever since the chromedp v0.7.3, the detectURL method was implemented in util.go to make it easier to send the base URL of a WS to NewRemoteAllocator. The rest of the URL is built by fetching the webSocketDebuggerUrl from
json/version
and constructing the URL again; however if the websocket is passed on with parameters, such as the case of an authentication token to a WSS for a hosted browser service, then it is impacting connection, since the parameter is dropped and the connection isn't successful.Steps to reproduce the problem:
This throws the following error
2021/12/03 14:42:06 Failed getting title of example.com: could not dial "ws://chrome.browserless.io": unexpected HTTP response status: 301
What was run to get this error message?
Run the Go script below
What did you expect to see?
I was expecting the WebSocket to connect properly and scrape the Title, which occurs when using v0.7.2.
What did you see instead?
I saw the following error message, with an unexpected HTTP response due to the fact that the token was not provided when the URL was reformatted through the detectURL method in util.go
Possible issue
This most likely has to do with PR #817
While trying to simplify the way the URL is passed on to NewRemoteAllocator, it is unfortunately removing the arguments passed after the hostname at the moment it reconstructs the URL with the
/json/version
payload. Important arguments are lost in the process such as the token that is used to authenticate to many hosted browser services.Possible fixes and justification
If the detectURL method returns Secure WebSockets as is, then they won't be modified by this function.
Why would this be important for WSS? Because most hosted browser services are running on WSS and are mainly the ones that require to authenticate through a token, which sometimes are passed through an argument such as this case and would make it important for it not be dropped from the URL.
Possible fixes
NewRemoteAllocator
accept url withoutdevtools/browser/...
#817 provides.Something like this could work for the util.go:
json/version
.The text was updated successfully, but these errors were encountered: