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

Support HTTPS_PROXY, HTTP_PROXY, and NO_PROXY #1440

Closed
Electroid opened this issue Nov 1, 2022 · 10 comments
Closed

Support HTTPS_PROXY, HTTP_PROXY, and NO_PROXY #1440

Electroid opened this issue Nov 1, 2022 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@Electroid
Copy link
Contributor

Developers sometimes need to configure a proxy when using Bun.

While Node.js has decided not to support this, these variables have been adopted by curl, wget, Ruby, Python, Go, etc. There is a comprehensive blog post by Gitlab that explains how each of these variables should work.

@Jarred-Sumner
Copy link
Collaborator

@cirospaciari is working on this

cirospaciari added a commit that referenced this issue Jan 17, 2023
@cirospaciari cirospaciari self-assigned this Jan 17, 2023
Jarred-Sumner pushed a commit that referenced this issue Jan 18, 2023
…1814)

* WIP: http_proxy implemented, first steps for https_proxy #1440

* add HTTP_PROXY support to upgrade_command and WIP: tunneling

* WIP async handshake, stuck on WANT_READ, try to defer  + check

* create and upgrade with proxy working, TLS and non-TLS to proxy TLS working

* bun install/upgrade/create working with http(s)_proxy #1440

* add NO_PROXY support #1440

* remove commented code and add TODO

* fix getHttpProxy no_proxy

* fix formatting

* refactor catch and getHttpProxy, fix empty strngs in env for proxy

* allow optimization for handleResponseBody
@Jarred-Sumner
Copy link
Collaborator

@cirospaciari has shipped this

@jylin
Copy link

jylin commented Oct 19, 2023

http_proxy and https_proxy don't seem to work for me for bun install and bun upgrade. I tried the capitalized variants too. Is this confirmed to be working?

For comparison, my proxy works with npm install, yarn install, and pnpm install.

@totaland
Copy link

Confirmed not working with proxy at my end. @jylin is that still the issue for you?

@jylin
Copy link

jylin commented Nov 27, 2023

Yea I don't think it works. bun install I can get around by using a different registry, but it would be nice if bun upgrade understood http proxy environment variables.

@wahyusa
Copy link

wahyusa commented Mar 16, 2024

Hi, I am using Bun v1.0.31 on Windows 11 with CMD, Git Bash, and pwsh but seems like all of them can't do bun install under proxy connection.
I am not using WSL or Docker.
Not installed Node.js.
I've already set and using proxy configuration and it works fine with git, composer, curl, etc.

Does this feature still not implemented for windows ?

Below is my bun install --verbose result when tried to install fresh Laravel dependencies.

Verbose log

[0.00ms] ".env"
bun install v1.0.31-canary.2 (8c5ac06)
Enqueue package manifest for download: @tailwindcss/forms
Enqueue package manifest for download: alpinejs
Enqueue package manifest for download: autoprefixer
Enqueue package manifest for download: axios
Enqueue package manifest for download: laravel-vite-plugin
Enqueue package manifest for download: postcss
Enqueue package manifest for download: tailwindcss
Enqueue package manifest for download: vite
🔍 Resolving [1/8] [PackageManager] waiting for 8 tasks
Request: GET /@tailwindcss%2fforms
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /alpinejs
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /autoprefixer
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /axios
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /laravel-vite-plugin
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /postcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /tailwindcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /vite
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Request: GET /@tailwindcss%2fforms
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /autoprefixer
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /laravel-vite-plugin
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /axios
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Request: GET /alpinejs
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /postcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /tailwindcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /vite
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Request: GET /@tailwindcss%2fforms
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /autoprefixer
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /axios
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /laravel-vite-plugin
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Request: GET /postcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /alpinejs
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /tailwindcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /vite
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Request: GET /autoprefixer
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /laravel-vite-plugin
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /axios
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /@tailwindcss%2fforms
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Request: GET /alpinejs
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /tailwindcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /postcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /vite
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Request: GET /autoprefixer
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /axios
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /laravel-vite-plugin
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /@tailwindcss%2fforms
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Request: GET /postcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /vite
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /alpinejs
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /tailwindcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Response: < 200 Connection established

Request: GET /laravel-vite-plugin
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /axios
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /autoprefixer
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /@tailwindcss%2fforms
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

🔍 laravel-vite-plugin [41/48]
error: Syscall downloading package manifest laravel-vite-plugin
Response: < 200 Connection established

🔍 @tailwindcss/forms [42/48]
error: Syscall downloading package manifest @tailwindcss/forms
Response: < 200 Connection established

🔍 autoprefixer [43/48]
error: Syscall downloading package manifest autoprefixer
Request: GET /alpinejs
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

🔍 axios [44/48]
error: Syscall downloading package manifest axios
Request: GET /vite
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /postcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Request: GET /tailwindcss
Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, /
Connection: keep-alive
User-Agent: Bun/1.0.31
Host: registry.npmjs.org
Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

🔍 vite [45/48] Response: < 200 Connection established

error: Syscall downloading package manifest vite
🔍 alpinejs [46/48]
error: Syscall downloading package manifest alpinejs
Response: < 200 Connection established

🔍 tailwindcss [47/48]
error: Syscall downloading package manifest tailwindcss
Response: < 200 Connection established

🔍 postcss [48/48]
error: Syscall downloading package manifest postcss
warn: Syscall downloading package manifest @tailwindcss/forms

warn: Syscall downloading package manifest autoprefixer

warn: Syscall downloading package manifest laravel-vite-plugin

warn: Syscall downloading package manifest axios

warn: Syscall downloading package manifest alpinejs

warn: Syscall downloading package manifest postcss

warn: Syscall downloading package manifest tailwindcss

warn: Syscall downloading package manifest vite

warn: Syscall downloading package manifest @tailwindcss/forms

warn: Syscall downloading package manifest autoprefixer

warn: Syscall downloading package manifest axios

warn: Syscall downloading package manifest laravel-vite-plugin

warn: Syscall downloading package manifest postcss

warn: Syscall downloading package manifest alpinejs

warn: Syscall downloading package manifest tailwindcss

warn: Syscall downloading package manifest vite

warn: Syscall downloading package manifest autoprefixer

warn: Syscall downloading package manifest laravel-vite-plugin

warn: Syscall downloading package manifest axios

warn: Syscall downloading package manifest @tailwindcss/forms

warn: Syscall downloading package manifest alpinejs

warn: Syscall downloading package manifest tailwindcss

warn: Syscall downloading package manifest postcss

warn: Syscall downloading package manifest vite

warn: Syscall downloading package manifest autoprefixer

warn: Syscall downloading package manifest axios

warn: Syscall downloading package manifest laravel-vite-plugin

warn: Syscall downloading package manifest @tailwindcss/forms

warn: Syscall downloading package manifest postcss

warn: Syscall downloading package manifest vite

warn: Syscall downloading package manifest alpinejs

warn: Syscall downloading package manifest tailwindcss

warn: Syscall downloading package manifest laravel-vite-plugin

warn: Syscall downloading package manifest axios

warn: Syscall downloading package manifest autoprefixer

warn: Syscall downloading package manifest @tailwindcss/forms

warn: Syscall downloading package manifest alpinejs

warn: Syscall downloading package manifest vite

warn: Syscall downloading package manifest postcss

warn: Syscall downloading package manifest tailwindcss
error: @tailwindcss/forms@^0.5.2 failed to resolve
error: alpinejs@^3.4.2 failed to resolve
error: autoprefixer@^10.4.2 failed to resolve
error: axios@^1.6.4 failed to resolve
error: laravel-vite-plugin@^1.0 failed to resolve
error: postcss@^8.4.31 failed to resolve
error: tailwindcss@^3.1.0 failed to resolve
error: vite@^5.0 failed to resolve

@clouds56
Copy link

same here on macOS, with https_proxy

@totaland
Copy link

@cirospaciari @Jarred-Sumner any update on this?

@seyfu-t
Copy link

seyfu-t commented Jun 27, 2024

@Electroid , @cirospaciari please reopen this, still not working

@Jarred-Sumner
Copy link
Collaborator

@seyfu-t can you open a new issue that includes a reproduction? HTTP_PROXY and HTTPS_PROXY do work and have unit tests to verify this, so we're going to need to see more specifically what's not working in order to fix it

@oven-sh oven-sh locked as resolved and limited conversation to collaborators Jun 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants