CA
foreign-sapphire

ERR_TUNNEL_CONNECTION_FAILED when running puppeteer with proxy chain package

I running this code on Linux VPS:
const puppeteer = require('puppeteer');
const proxyChain = require('proxy-chain');

(async () => {
const oldProxyUrl = 'http://auto:[email protected]:8000';
const newProxyUrl = await proxyChain.anonymizeProxy(oldProxyUrl);

console.log(newProxyUrl);

const browser = await puppeteer.launch({
args: [`--proxy-server=${newProxyUrl}`],
});

// Do your magic here...
const page = await browser.newPage();
await page.goto('https://www.example.com');
})();
const puppeteer = require('puppeteer');
const proxyChain = require('proxy-chain');

(async () => {
const oldProxyUrl = 'http://auto:[email protected]:8000';
const newProxyUrl = await proxyChain.anonymizeProxy(oldProxyUrl);

console.log(newProxyUrl);

const browser = await puppeteer.launch({
args: [`--proxy-server=${newProxyUrl}`],
});

// Do your magic here...
const page = await browser.newPage();
await page.goto('https://www.example.com');
})();
But getting this error: Error: net::ERR_TUNNEL_CONNECTION_FAILED at https://www.google.com/
2 Replies
foreign-sapphire
foreign-sapphireOP3y ago
I also tried with fingerprint packages as well:
const proxyChain = require('proxy-chain');
const puppeteer = require('puppeteer');
const { FingerprintGenerator } = require('fingerprint-generator');
const { FingerprintInjector } = require('fingerprint-injector');

(async () => {

const oldProxyUrl = 'http://auto:[email protected]:8000';
const newProxyUrl = await proxyChain.anonymizeProxy(oldProxyUrl);

const fingerprintGenerator = new FingerprintGenerator();

const browserFingerprintWithHeaders = fingerprintGenerator.getFingerprint({
devices: ['desktop'],
browsers: ['chrome'],
});

const fingerprintInjector = new FingerprintInjector();

const browser = await puppeteer.launch({
args: [`--proxy-server=${newProxyUrl}`, '--no-sandbox', '--disable-setuid-sandbox'],
headless: true,
ignoreHTTPSErrors: true,
});

const page = await browser.newPage();

await fingerprintInjector.attachFingerprintToPuppeteer(page, browserFingerprintWithHeaders);

// ... your code using `page` here

const url = "https://www.google.com";
await page.goto(url);

await page.screenshot({
path: `newproxy.jpg`
});

await browser.close();
})();
const proxyChain = require('proxy-chain');
const puppeteer = require('puppeteer');
const { FingerprintGenerator } = require('fingerprint-generator');
const { FingerprintInjector } = require('fingerprint-injector');

(async () => {

const oldProxyUrl = 'http://auto:[email protected]:8000';
const newProxyUrl = await proxyChain.anonymizeProxy(oldProxyUrl);

const fingerprintGenerator = new FingerprintGenerator();

const browserFingerprintWithHeaders = fingerprintGenerator.getFingerprint({
devices: ['desktop'],
browsers: ['chrome'],
});

const fingerprintInjector = new FingerprintInjector();

const browser = await puppeteer.launch({
args: [`--proxy-server=${newProxyUrl}`, '--no-sandbox', '--disable-setuid-sandbox'],
headless: true,
ignoreHTTPSErrors: true,
});

const page = await browser.newPage();

await fingerprintInjector.attachFingerprintToPuppeteer(page, browserFingerprintWithHeaders);

// ... your code using `page` here

const url = "https://www.google.com";
await page.goto(url);

await page.screenshot({
path: `newproxy.jpg`
});

await browser.close();
})();
but still getting same error: Error: net::ERR_TUNNEL_CONNECTION_FAILED at https://google.com not sure if apify proxy servers are not working or I am missing anything in code? Any suggestions? I changed apify proxy server to different proxy server and I was able to execute above code. Looks like there is some issue with Apify proxy One follow up question if we are using residential proxies or proxy server with dynamic IPs do we still need to use createTunnnel() closeTunnel() from proxychain package?
foreign-sapphire
foreign-sapphire3y ago
GitHub
actor-templates/main.js at master · apify/actor-templates
This project is the :house: home of Apify actor template projects to help users quickly get started. - actor-templates/main.js at master · apify/actor-templates

Did you find this page helpful?