page.setExtraHTTPHeaders cause 'ERR_INVALID_ARGUMENT' error
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.20.0
- Platform / OS version: mac OS
- URLs (if applicable):
- Node.js version: v11.11.0
What steps will reproduce the problem?
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
headless: false,
ignoreHTTPSErrors: true,
ignoreDefaultArgs: ["--enable-automation"],
args: [
'–no-sandbox',
]
});
const page = await browser.newPage();
await page.setExtraHTTPHeaders(
{'proxy-authorization': 'test'}
);
await page.goto('http://example.com/');
await page.waitFor(10000);
await browser.close();
})();
What is the expected result? go to the url success
What happens instead?
(node:86672) UnhandledPromiseRejectionWarning: Error: net::ERR_INVALID_ARGUMENT at http://example.com/
at navigate (/Users/andrew/Documents/otherProject/vs/demo/node_modules/puppeteer/lib/FrameManager.js:120:37)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
-- ASYNC --
at Frame.<anonymous> (/Users/andrew/Documents/otherProject/vs/demo/node_modules/puppeteer/lib/helper.js:111:15)
at Page.goto (/Users/andrew/Documents/otherProject/vs/demo/node_modules/puppeteer/lib/Page.js:674:49)
at Page.<anonymous> (/Users/andrew/Documents/otherProject/vs/demo/node_modules/puppeteer/lib/helper.js:112:23)
at /Users/andrew/Documents/otherProject/vs/demo/demo.js:16:16
at processTicksAndRejections (internal/process/next_tick.js:81:5)
But, if I replace header proxy-authorization
to proxyauthorization
, it’s fine.
So,it seems that it’s not allowed containing ‘-’ in header, is this corrent? Or is it an issue?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:16
Top Results From Across the Web
How to solve Puppeteer Chrome Error ... - Christian Fei
The main issue was that I tried to authenticate to the proxy with setExtraHTTPHeaders , like this: await page.setExtraHTTPHeaders({
Read more >Developers - page.setExtraHTTPHeaders cause ...
page.setExtraHTTPHeaders cause 'ERR_INVALID_ARGUMENT' error. ... Coming soon: A brand new website interface for an even better experience!
Read more >node.js - Puppeteer not loading page - NodeJs - Stack Overflow
It seems that page.authenticate is not working for me either,instead you can use page.setExtraHTTPHeaders. async function run() { const ...
Read more >How to solve Puppeteer Chrome Error ... - diff.blog
The main issue was that I tried to authenticate to the proxy with setExtraHTTPHeaders, like this: await page.setExtraHTTPHeaders({ 'Proxy- ...
Read more >How to use setExtraHTTPHeaders function in Page - Tabnine
logger.info('set headers to puppeteer page', this.headers); await page.setExtraHTTPHeaders(this.headers);
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We’re getting the same
ERR_INVALID_ARGUMENT
error when setting aHost
header viapage.setExtraHTTPHeaders()
and loadinghttp://localhost/path/to/tested/page
. When I curl it, I get the response I expect:Using
v2.0.0
.I wonder if setting (resetting?) some headers is bad?
https://github.com/chromium/chromium/blob/b2254b38369f4f8ce8685b7a82dee1251f6cea22/services/network/url_loader.cc#L679-L683
https://github.com/chromium/chromium/blob/3611052c055897e5ebbc5b73ea295092e0c20141/services/network/public/cpp/header_util_unittest.cc#L50