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

[BUG] No exception is thrown if invalid token is provided when connecting to a remote instance of BrowserServer #4966

Closed
fabiomoggi opened this issue Jan 11, 2021 · 0 comments · Fixed by #4978
Assignees

Comments

@fabiomoggi
Copy link

Context:

  • Playwright Version: 1.7
  • Operating System: Windows
  • Node.js version: 10.12
  • Browser: All

Code Snippet

Script to fire up server:

const {chromium} = require('playwright');

(async () => {
    const browserServer = await chromium.launchServer({
        port: 9090
    })
})();

Client script that connects to the remote instance of BrowserServer:

const {chromium} = require('playwright');

(async () => {
    // IP address is valid, however, token c0a52db5d206c93707156e5b85b4c02 is not.
    var wsEndpoint = "ws://127.0.0.1:9090/c0a52db5d206c93707156e5b85b4c02"
    try {
        const browser = await chromium.connect({
            wsEndpoint: wsEndpoint });
        const page = await browser.newPage();
        //....
    } catch (error) {
        // Invalid token exception is never thrown
        console.log(error.message)
    }
})();

Describe the bug

  • Issue: When trying to connect to a remote instance of BrowserServer with an invalid Token Id, my node.js application exits with no error code/message.
  • Expected Behavior: If an invalid Token Id is provided to the wsEndpoint parameter of chromium.connect(), it should throw a catchable exception, so we can properly handle application workflow.
  • Use Case: Since I have a virtual machine on Azure running the remote browser server instance, my IP and Token will vary whenever a new internet connection is renewed. Once my node.js app is up, it sends the current IP and Token to the database so all clients can connect to with valid token access.

BTW: I love the extra layer of security by adding tokenization to the connection. Last time I checked Puppeteer, it was not able to perform it. Keep doing the great job, Playwright team!

@fabiomoggi fabiomoggi changed the title [BUG] [BUG] No exception is thrown if invalid token is provided when connecting to a remote instance of BrowserServer Jan 11, 2021
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

Successfully merging a pull request may close this issue.

3 participants