question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browser has disconnected for the first HTTPS request when using proxy.

See original GitHub issue

Environment:

  • Puppeteer version: v1.13.0
  • Platform / OS version: Windows 10
  • URLs (if applicable): -
  • Node.js version: v10.14.2

What steps will reproduce the problem?

const puppeteer = require('puppeteer');
const proxy = {
    ip: '***.***.**.**',
    port: '8080',
    username: '****',
    password: '****'
};

// const proxy = null;

(async () => {
    const args = [];
    if (proxy) {
        args.push(`--proxy-server=${proxy.ip}:${proxy.port}`);
    }
    browser = await puppeteer.launch({
        args: args,
        ignoreHTTPSErrors: false,
        headless: false
    });
    console.log('Browser launched.');
    const pages = await browser.pages();
    const page = pages.length ? pages[0] : await browser.newPage();

    if (proxy && proxy.username) {
        await page.authenticate({
            username: proxy.username,
            password: proxy.password,
        });
    }

    // await page.goto('http://example.com');
    await page.goto('https://example.com');
    await page.screenshot({path: 'example.png'});
    await browser.close();
})()
    .then(() => console.log('Done'))
    .catch((err) => console.error(err));

What is the expected result? The first HTTPS is success when using proxy (without placing HTTP request before the HTTPS).

What happens instead?

  • When use proxy the first HTTPS request of page.goto throw “Error: Navigation failed because browser has disconnected!”
  • When remove proxy the first HTTPS request success.
  • When add proxy but place HTTP request before HTTPS, the HTTPS request success.
  • When replaced Puppeteer with the older (v1.12.2) with copy/paste - everything works successfully (as expected).
  • When replaced Puppeteer with the older (v1.12.2) with “npm i” of “package-lock.json” - the error repeats.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
ilyakolkercommented, Mar 17, 2019

This issue related to the latest version(1.13.0) the browser disconnects on https websites when using proxy with page.authenticate(). The last version(1.12.2) is working as expected.

2reactions
ukrexpocommented, Mar 16, 2019

Right, browser crashes when connects to HTTPS in headful mode. The script was working as expected, until I have reinstalled “npm i puppeteer” 2019.03.08. After the installation the error appears every time if HTTPS request goes first. The previous version of Puppeteer was installed 2019.02.27 and worked (and working now) as expected (without any error).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browser has disconnected for the first HTTPS request ... - GitHub
This issue related to the latest version(1.13.0) the browser disconnects on https websites when using proxy with page.authenticate(). The last ...
Read more >
node.js - "Client network socket disconnected before secure ...
I think the problem was solvable because nodejs doesn't send the request through my vpn proxy. So my question is somewhat related to...
Read more >
How to Fix the ERR_CONNECTION_RESET Error in 7 Ways
7 Methods to Fix the ERR_CONNECTION_RESET Error · 1. Check If the Website Is Working · 2. Disconnect from VPN · 3. Reboot...
Read more >
ERR_CONNECTION_RESET: How to fix the Chrome ... - IONOS
Solution 2: check the proxy settings ... One of the most common reasons for the “ERR_CONNECTION_RESET” error is that a proxy server has...
Read more >
How to resolve NPM proxy issue whilel running node JS ...
The way to go is then to talk to your network administrator/hierarchy and try and get the proxy configured to allow such access....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found