Repository navigation
feat(aws-serverless): Send Lambda extension envelopes through http_proxy #26359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,21 +60,32 @@ export function makeNodeTransport(options: NodeTransportOptions): Transport { | |
|
|
||
| const isHttps = urlSegments.protocol === 'https:'; | ||
|
|
||
| // Proxy prioritization: http => `options.proxy` | `process.env.http_proxy` | ||
| // Proxy prioritization: https => `options.proxy` | `process.env.https_proxy` | `process.env.http_proxy` | ||
| const nativeHttpModule = isHttps ? https : http; | ||
| const agent = getHttpAgent(urlSegments, { proxy: options.proxy, keepAlive: options.keepAlive }); | ||
|
|
||
| const requestExecutor = createRequestExecutor(options, options.httpModule ?? nativeHttpModule, agent); | ||
| return createTransport(options, requestExecutor); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the agent for requests to `url`: a proxy agent when a proxy applies, otherwise a plain keep-alive agent. | ||
| * | ||
| * Proxy prioritization: http => `options.proxy` | `process.env.http_proxy` | ||
| * Proxy prioritization: https => `options.proxy` | `process.env.https_proxy` | `process.env.http_proxy` | ||
| * Hosts listed in `process.env.no_proxy` are never proxied. | ||
| */ | ||
| export function getHttpAgent(url: URL, options: { proxy?: string; keepAlive?: boolean } = {}): http.Agent { | ||
| const isHttps = url.protocol === 'https:'; | ||
| const proxy = applyNoProxyOption( | ||
| urlSegments, | ||
| url, | ||
| options.proxy || (isHttps ? process.env.https_proxy : undefined) || process.env.http_proxy, | ||
| ); | ||
|
|
||
| const nativeHttpModule = isHttps ? https : http; | ||
| const keepAlive = options.keepAlive ?? true; | ||
| const agent = proxy | ||
| ? (new HttpsProxyAgent(proxy) as http.Agent) | ||
| : new nativeHttpModule.Agent({ keepAlive, maxSockets: 30, timeout: 2000 }); | ||
| if (proxy) { | ||
| return new HttpsProxyAgent(proxy); | ||
| } | ||
|
|
||
| const requestExecutor = createRequestExecutor(options, options.httpModule ?? nativeHttpModule, agent); | ||
| return createTransport(options, requestExecutor); | ||
| return new (isHttps ? https : http).Agent({ keepAlive: options.keepAlive ?? true, maxSockets: 30, timeout: 2000 }); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extension inherits two-second socket timeoutMedium Severity The non-proxy agent from Additional Locations (1)Reviewed by Cursor Bugbot for commit 71b1c25. Configure here.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. False positive. The agent's |
||
| } | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| export type { NodeTransportOptions } from './http'; | ||
|
|
||
| export { makeNodeTransport } from './http'; | ||
| export { getHttpAgent, makeNodeTransport } from './http'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. l: Is it required that
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not required, but discussed below 😅
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Totally missed that. Thanks for the update |
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we no longer pass the underlying
ArrayBufferaround, so this slicing isn't needed anymore