Troubleshooting: Puppeteer proxy connection fails on Debian but works on Windows

I’m having trouble setting up a proxy with Puppeteer on my Debian 12 system. Here’s what’s going on:

  • I bought a proxy from a service called froxy
  • I’m using their sample code to test the connection
  • It works fine on my Windows machine
  • But on Debian, I get a net::ERR_TUNNEL_CONNECTION_FAILED error

Here’s a simplified version of the code I’m trying:

const puppeteer = require('puppeteer');

async function testProxy() {
  const browser = await puppeteer.launch({
    headless: true,
    args: ['--proxy-server=myproxy.example.com:8080']
  });
  const page = await browser.newPage();
  await page.authenticate({ username: 'user', password: 'pass' });
  await page.goto('https://example.com/ip-check');
  await browser.close();
}

testProxy();

Any ideas on what might be causing this issue on Debian? I’m not sure where to start troubleshooting. Could it be a firewall problem or something else?

I’ve encountered this issue before when working with Puppeteer on Debian systems. One often overlooked aspect is the system’s DNS configuration. Ensure your /etc/resolv.conf file is correctly set up and pointing to valid DNS servers. Additionally, verify that your system’s date and time are accurate, as SSL certificate validation can fail if they’re off. If those check out, you might want to try adding ‘–no-sandbox’ to your Puppeteer launch arguments. While not ideal for production, it can help isolate whether the issue is related to Chromium’s sandbox on Debian. Lastly, double-check that your proxy service explicitly supports Linux systems, as some are optimized primarily for Windows environments.

hey man, i had similar issues on debian. Have u tried checking ur firewall settings? sometimes iptables can block outgoing connections. also, make sure ur proxy credentials r correct and the proxy service supports linux. good luck troubleshooting!

I’ve run into this exact problem before on Debian. Here’s what worked for me:

First, make sure you’ve got all the necessary dependencies installed. Puppeteer needs stuff like libx11-xcb1, libxcomposite1, and libxdamage1. You can install them with:

sudo apt-get install libx11-xcb1 libxcomposite1 libxdamage1

Also, check if you can reach the proxy server from your Debian machine. Try using curl with the proxy:

curl -x http://user:[email protected]:8080 https://example.com/ip-check

If that fails, it might be a network issue. Make sure your proxy settings are correct in /etc/environment or your .bashrc file.

Lastly, try running Puppeteer with --no-sandbox and --disable-setuid-sandbox flags. It’s not ideal for production, but it can help isolate the issue:

args: [‘–no-sandbox’, ‘–disable-setuid-sandbox’, ‘–proxy-server=myproxy.example.com:8080’]

Hope this helps! Let me know if you need more info.