mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: update to https-proxy-agent@^5.0.0 to fix ERR_INVALID_PROTOCOL
(#6555)
With `nodejs@15.0.1`, install puppeteer with `https_proxy` set causes an error like: ``` > puppeteer@5.4.1 install node_modules/puppeteer > node install.js ERROR: Failed to set up Chromium r809590! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download. TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:" at new NodeError (node:internal/errors:258:15) at new ClientRequest (node:_http_client:155:11) at Object.request (node:https:313:10) at httpRequest (node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:488:17) at downloadFile (node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:357:21) at BrowserFetcher.download (node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:239:19) at async downloadBrowser (node_modules/puppeteer/lib/cjs/puppeteer/node/install.js:48:5) { code: 'ERR_INVALID_PROTOCOL' } ``` The related issue is at https://github.com/TooTallNate/node-agent-base/pull/47, from package `agent-base` under `https-proxy-agent` And the version bump is for `Refactor to TypeScript` is here: https://github.com/TooTallNate/node-https-proxy-agent/compare/4.0.0...5.0.0
This commit is contained in:
parent
470124fb2b
commit
3bf5a55289
@ -49,7 +49,7 @@
|
|||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
"devtools-protocol": "0.0.818844",
|
"devtools-protocol": "0.0.818844",
|
||||||
"extract-zip": "^2.0.0",
|
"extract-zip": "^2.0.0",
|
||||||
"https-proxy-agent": "^4.0.0",
|
"https-proxy-agent": "^5.0.0",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"pkg-dir": "^4.2.0",
|
"pkg-dir": "^4.2.0",
|
||||||
"progress": "^2.0.1",
|
"progress": "^2.0.1",
|
||||||
|
@ -28,7 +28,10 @@ import { debug } from '../common/Debug.js';
|
|||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
import removeRecursive from 'rimraf';
|
import removeRecursive from 'rimraf';
|
||||||
import * as URL from 'url';
|
import * as URL from 'url';
|
||||||
import ProxyAgent from 'https-proxy-agent';
|
import createHttpsProxyAgent, {
|
||||||
|
HttpsProxyAgent,
|
||||||
|
HttpsProxyAgentOptions,
|
||||||
|
} from 'https-proxy-agent';
|
||||||
import { getProxyForUrl } from 'proxy-from-env';
|
import { getProxyForUrl } from 'proxy-from-env';
|
||||||
import { assert } from '../common/assert.js';
|
import { assert } from '../common/assert.js';
|
||||||
|
|
||||||
@ -557,7 +560,7 @@ function httpRequest(
|
|||||||
|
|
||||||
type Options = Partial<URL.UrlWithStringQuery> & {
|
type Options = Partial<URL.UrlWithStringQuery> & {
|
||||||
method?: string;
|
method?: string;
|
||||||
agent?: ProxyAgent;
|
agent?: HttpsProxyAgent;
|
||||||
rejectUnauthorized?: boolean;
|
rejectUnauthorized?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -581,9 +584,9 @@ function httpRequest(
|
|||||||
const proxyOptions = {
|
const proxyOptions = {
|
||||||
...parsedProxyURL,
|
...parsedProxyURL,
|
||||||
secureProxy: parsedProxyURL.protocol === 'https:',
|
secureProxy: parsedProxyURL.protocol === 'https:',
|
||||||
} as ProxyAgent.HttpsProxyAgentOptions;
|
} as HttpsProxyAgentOptions;
|
||||||
|
|
||||||
options.agent = new ProxyAgent(proxyOptions);
|
options.agent = createHttpsProxyAgent(proxyOptions);
|
||||||
options.rejectUnauthorized = false;
|
options.rejectUnauthorized = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user