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
…ded before use
  • Loading branch information
Paras committed Jan 15, 2025
1 parent b885c9e commit f451fd3
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).toString()]

Check failure on line 143 in server/aws-lsp-codewhisperer/src/language-server/utils.ts

View workflow job for this annotation

GitHub Actions / Test public NPM packages

Property 'readFileSync' does not exist on type '{ copyFile: (src: string, dest: string, options?: { ensureDir?: boolean | undefined; } | undefined) => Promise<void>; exists: (path: string) => Promise<boolean>; ... 9 more ...; mkdir: (path: string, options?: { ...; } | undefined) => Promise<...>; }'. Did you mean 'readFile'?

Check failure on line 143 in server/aws-lsp-codewhisperer/src/language-server/utils.ts

View workflow job for this annotation

GitHub Actions / Package (Windows)

Property 'readFileSync' does not exist on type '{ copyFile: (src: string, dest: string, options?: { ensureDir?: boolean | undefined; } | undefined) => Promise<void>; exists: (path: string) => Promise<boolean>; ... 9 more ...; mkdir: (path: string, options?: { ...; } | undefined) => Promise<...>; }'. Did you mean 'readFile'?

Check failure on line 143 in server/aws-lsp-codewhisperer/src/language-server/utils.ts

View workflow job for this annotation

GitHub Actions / Package

Property 'readFileSync' does not exist on type '{ copyFile: (src: string, dest: string, options?: { ensureDir?: boolean | undefined; } | undefined) => Promise<void>; exists: (path: string) => Promise<boolean>; ... 9 more ...; mkdir: (path: string, options?: { ...; } | undefined) => Promise<...>; }'. Did you mean 'readFile'?

Check failure on line 143 in server/aws-lsp-codewhisperer/src/language-server/utils.ts

View workflow job for this annotation

GitHub Actions / Test (Windows)

Property 'readFileSync' does not exist on type '{ copyFile: (src: string, dest: string, options?: { ensureDir?: boolean | undefined; } | undefined) => Promise<void>; exists: (path: string) => Promise<boolean>; ... 9 more ...; mkdir: (path: string, options?: { ...; } | undefined) => Promise<...>; }'. Did you mean 'readFile'?

Check failure on line 143 in server/aws-lsp-codewhisperer/src/language-server/utils.ts

View workflow job for this annotation

GitHub Actions / Test

Property 'readFileSync' does not exist on type '{ copyFile: (src: string, dest: string, options?: { ensureDir?: boolean | undefined; } | undefined) => Promise<void>; exists: (path: string) => Promise<boolean>; ... 9 more ...; mkdir: (path: string, options?: { ...; } | undefined) => Promise<...>; }'. Did you mean 'readFile'?
: undefined
: undefined
const agent = new HttpsProxyAgent({
Expand Down

0 comments on commit f451fd3

Please sign in to comment.