fix(stylua-npm-bin): adjust axios config to work with proxy env variables#868
Conversation
|
@JohnnyMorganz let me know what you think regarding this MR / a refactoring without |
JohnnyMorganz
left a comment
There was a problem hiding this comment.
Thanks for your interest and the PR! Fix looks pretty reasonable to me, happy to merge it in. I haven't tested it myself but the general smoke test still works so I'll take your word for it if the proxy setup works too 😁
Also happy to switch away from using axios if there is a benefit in doing so. I don't remember any particular reason it was chosen (other than being able to stream and pipe the result, but maybe other libraries can do that too). I just noticed in your diff that we already have a dependency on node-fetch, but don't seem to use it... If it doesn't really bring any improvements though then it's probably fine to just leave it be.
It might take a bit of time for this fix to make its way to a release unfortunately. I'm hoping to pick up some work and get a v2 release out, but that may take a while. Let me know if it would be beneficial for a patch release.
|
Thanks for the quick merge @JohnnyMorganz!
TBH, I was not expecting such a quick merge 😁. I can still add a small test a-la https://github.com/TooTallNate/proxy-agents/blob/main/packages/proxy-agent/test/test.ts with a mock proxy server if you think it is necessary (seems a simpler solution than testing this with GitHub actions but maybe I'm wrong).
Yes, see https://medium.com/deno-the-complete-reference/download-file-with-fetch-in-node-js-57dd370c973a for instance.
After having went through the proxy-related axios issues, I do think switching for a more-adopted solution would only make the maintenance easier (and you already have the dep on But I don't want to force your decision here, just let me know and I would be happy to refactor.
Alright, no pressure. I will implement a quick Thanks again for maintaining this tool 👍🏻 |
Hello,
First of all, thanks for providing this code formatter on so many distribution channels 🙏🏻
We wanted to pull the wrapper from npm so we added it to our
yarndependencies.However, since we are behind a corporate proxy, the install just failed. More precisely,
axioswas not correctly resolving the GitHub redirects in addition to our proxy environment variables:Some output from our GitLab CI job
This is kind of a known issue, see axios/axios#2072 for instance.
This MR implements the fix proposed in axios/axios#4531 (comment).
If you are open to it, another option would be to get rid of
axios. I see it is only used once so I could refactor the code and just switch to a nativenodefetch. I could use the undici - fetch for instance: we recently contributed upstream to editorconfig-checker to also bring back support for http proxies 😉/cc @nejch @fgreinacher @bufferoverflow
🛠️ with ❤️ by Siemens