'ERR_HTTP_RESPONSE_CODE_FAILURE (HTTP Auth Error 407) on Puppeteer
const puppeteer = require('puppeteer-extra');
const chalk = require('chalk');;
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
const modules = require('./modules.js');
const randomInfo = require('./randomInfo.js');
const proxy = require('./proxies.js');
async function hello() {
puppeteer.use(StealthPlugin())
proxy.getProxy()
this.accountMode = "1";
const browser = await puppeteer.launch({
headless: false,
ignoreHTTPSErrors: true,
args: [`--proxy-server=${proxies.ip}:${proxies.port}`]
})
const page = await browser.newPage();
await page.authenticate({
username : proxies.user,
password : proxies.pass
});
if (this.accountMode == "1" || this.accountMode == "2") {
await page.goto('https://www.nike.com/register')
} else if (this.accountMode == "3") {
await page.goto('https://www.nike.com/')
}
console.log(chalk.cyan(`Using Proxy --- ${proxies.proxy}`))
}
hello()
After running the following code, the Puppeteer chrome browser will load successfully, but it will return a 407 error (Proxy Auth related). I have checked the values on all parts of the proxy in this case, and they are all correct. I have checked all my code numerous times and I cannot seem to find why I am having proxy auth issues.
Please let me know of a possible solution to this issue.
Solution 1:[1]
It looks like proxies
is undefined, so page.authenticate
won't have any credentials to push. Assuming you are using getProxy
to get the proxy data, you would need to define it like:
const proxies = proxy.getProxy()
Note: This issue could also occur if the proxy provider isn't configured correctly (i.e. An non-whitelisted IP). You can find why this failure is occurring by enabling puppeteer's debug with:
DEBUG=puppeteer node hello.js
or adding it to the command you are using to run the code / adding it to the package.json
command
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tyler Richards |