Page.goto: net::err_aborted

Explanation of Error ‘net::err_aborted’

The error ‘net::err_aborted’ occurs when a network request initiated by a webpage is aborted or terminated before it can be successfully completed. This error can have multiple underlying causes, and understanding them can help in troubleshooting and resolving the issue.

Possible Causes:

  1. Invalid URL or DNS Resolution Failure:

    This error can occur if the specified URL is invalid or doesn’t exist. It can also happen if there is a problem with the DNS (Domain Name System) server responsible for translating the URL into an IP address. For example:

            const url = 'https://example.invalid';
            await page.goto(url); // Causes 'net::err_aborted'
          
  2. Insecure HTTP Requests:

    Chrome by default blocks insecure (non-HTTPS) requests when the webpage is loaded over HTTPS. If the requested URL uses HTTP instead of HTTPS, the network request will be aborted, resulting in the ‘net::err_aborted’ error. To resolve this, make sure the requests are made using HTTPS:

            const url = 'http://example.com';
            await page.goto(url); // Causes 'net::err_aborted'
          
  3. Web Server Issues:

    The error can also be caused by issues on the web server’s side, such as misconfigured settings, server overload, or firewall restrictions. In such cases, the server may intentionally terminate the connection, leading to the ‘net::err_aborted’ error.

  4. Browser Network Timeout:

    If the network request takes too long to complete, the browser may decide to abort it to prevent excessive waiting. This can be due to slow network connections, high load on the server, or inefficiently designed web pages that result in prolonged request times.

Example:

    const puppeteer = require('puppeteer');

    (async () => {
      const browser = await puppeteer.launch();
      const page = await browser.newPage();

      try {
        const url = 'https://example.com';
        await page.goto(url); // Causes 'net::err_aborted' if the network request fails
      } catch (error) {
        console.error('Error:', error);
      } finally {
        await browser.close();
      }
    })();
  

Leave a comment