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

Conversation

pras0131
Copy link
Contributor

@pras0131 pras0131 commented Jan 15, 2025

convert makeProxyConfig function to sync as to allow proxy configurations to be loaded before being used. There has been an issue where proxy was not working for inline completions as the configurations were being loaded asyncronously and when the client was setting the configs, they were not set. The change aims to fix the issue and it has been tested on local environment to be working fine using Charles proxy for inline completions.

[[ THE CHANGE IS DEPENDENT ON THIS PR https://github.com/aws/language-server-runtimes/pull/299/files]

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@pras0131 pras0131 requested a review from a team as a code owner January 15, 2025 18:37
@@ -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()]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to have a separate method for synchronous file read? Have you tried solutions with using 'readFile' async in a factory create method instead of the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this as a clean way to do it. Factory create instead of constructor is not required here and it would lead to a lot of refactoring, which might not be required.

@pras0131 pras0131 merged commit 7ea8150 into main Jan 16, 2025
6 checks passed
@pras0131 pras0131 deleted the fixProxyIssueForInlineCompletion branch January 16, 2025 12:35
volodkevych pushed a commit that referenced this pull request Jan 16, 2025
#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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants