Skip to content

Commit

Permalink
fix: convert makeProxyConfig to sync to allow proxy configs to be loa… (
Browse files Browse the repository at this point in the history
#725)

* fix: convert makeProxyConfig to sync to allow proxy configs to be loaded before use

* fix: remove toString() as return type changed to string now

---------

Co-authored-by: Paras <pmiparas@amazon.com>
  • Loading branch information
pras0131 and Paras authored Jan 16, 2025
1 parent 73048a7 commit 7ea8150
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
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

0 comments on commit 7ea8150

Please sign in to comment.