Image of error I receive while the code executes
Here is the code I am using :
proxy.js -
class Proxy
{
static create() {
return new Proxy();
}
this.browser = await puppeteer.launch({
args: [`--proxy-server=socks5:127.0.0.1:9150`, "--no-sandbox",
],
});
async newPage(newBrowser = false) {
/* Ensure a browser instance is present */
if (!this.browser) {
await this.launchNewBrowser();
}
/* Close all other pages/tabs */
await this.closePages();
}
connections.js ( calling from this file )
const createTBrowser = require("..pathTo/proxy");
const Browser = createBrowser();
const page = await Browser.newPage();
await page.goto('Valid_URL');
The proxy is not working because the pupeteer is using a self signed cert,so adding a ignore flag to the args might fix your problem.
`class Proxy
{
static create() {
return new Proxy();
}
this.browser = await puppeteer.launch({
args: [`--proxy-server=socks5:127.0.0.1:9150`,
"--no-sandbox",
"--ignore-certificate-errors",
"--ignore-certificate-errors-spki-list" ,
],
});
async newPage(newBrowser = false) {
/* Ensure a browser instance is present */
if (!this.browser) {
await this.launchNewBrowser();
}
/* Close all other pages/tabs */
await this.closePages();
}`