Skip to content
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

fix: convert makeProxyConfig to sync to allow proxy configs to be loa… #725

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ export abstract class CodeWhispererServiceBase {
abstract generateSuggestions(request: GenerateSuggestionsRequest): Promise<GenerateSuggestionsResponse>

constructor(workspace: Workspace, codeWhispererRegion: string, codeWhispererEndpoint: string) {
;(async () => {
this.proxyConfig = await makeProxyConfig(workspace)
})()
this.proxyConfig = makeProxyConfig(workspace)
this.codeWhispererRegion = codeWhispererRegion
this.codeWhispererEndpoint = codeWhispererEndpoint
}
Expand Down
4 changes: 2 additions & 2 deletions server/aws-lsp-codewhisperer/src/language-server/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function getEndPositionForAcceptedSuggestion(content: string, startPositi
return endPosition
}

export const makeProxyConfig = async (workspace: Workspace) => {
export const makeProxyConfig = (workspace: Workspace) => {
let additionalAwsConfig: ConfigurationOptions = {}
// short term solution to fix webworker bundling, broken due to this node.js specific logic in here
const isNodeJS: boolean = typeof process !== 'undefined' && process.release && process.release.name === 'node'
Expand All @@ -140,7 +140,7 @@ export const makeProxyConfig = async (workspace: Workspace) => {
if (proxyUrl) {
const certs = isNodeJS
? process.env.AWS_CA_BUNDLE
? [await workspace.fs.readFile(process.env.AWS_CA_BUNDLE)]
? [workspace.fs.readFileSync(process.env.AWS_CA_BUNDLE)]
: undefined
: undefined
const agent = new HttpsProxyAgent({
Expand Down
Loading