You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use proxy network, like http(s) or socks5, I use http_proxy and https_proxy environment variable that are supported by many tools. Currently, clasp can't work in proxy environment, for example clasp login and clasp clone.
Reacted by andre, Lourens Marx, Krystian Kowal, Xiang Li, Ejaz-Zhuo-Han, HellDuke, Luis Gustavo, AKASAKA, gk, theshank and 3 more
I'm not sure what this would change would entail.
Can you be more specific about repro steps, some links, and a more detailed proposal on what commands this would be needed for?
It looks like this request would want to add something like: --proxy "socks5://127.0.0.1/"
to every command.
I'm using clasp from a censored internet where all things Google are blocked and need the proxy feature. Using proxy environment variables doesn't work.
Aha, please look at the same issue for firebase command line tool firebase/firebase-tools#155 . Nearly 2 years and 81 comments! Under certain conditions, people can't connect internet directly. That's it.
Unfortunately G Suite and many of Google's services are blocked in China. I can't solve that issue. I'm guessing the Firebase tool would probably prefer to not be blocked too to solve that linked issue.
I don't understand why environment variables don't work, do you really need every single tool you use to implement a custom --proxy option?
Underneath it all, we use googleapis. It supports a proxy (HTTP_PROXY, HTTPS_PROXY). Does that not work?
To implement this feature, I'd need:
A reasonable number of people to request and use the proxy feature (👍 the issue)
A design doc for this feature.
Ideally a pull request with an initial implementation.
To be honest, I have no use for this feature and still don't understand why you can't use a proxy elsewhere in the tech stack.
Hello, I'm running through the same problem. I tried setting up my user variables with proxy settings, and I'm still receiving the error below:
Error retrieving access token: Error: connect ETIMEDOUT 172.217.18.170:443
I'm in favor of adding a proxy option, but to be honest, I don't know how to run a proxy and I don't know why env variables don't work like in the googleapis README:
If someone wants to try this, add a proxy variable to this line of code: https://github.com/google/clasp/blob/master/src/auth.ts#L40
Then rebuild clasp and test it out, and it works, that'd be awesome. Then I can update clasp to include this proxy param.
If someone (@hanguokai, @nepsilon) describes exact steps on how to download a proxy, see the error in clasp using some tool, I'll try to reproduce the problem and create a solution.
If you need help with a pull request, or building clasp, LMK too.
This is the most upvoted issue, and it looks like user variables doesn't work, so I'm in favor of support this feature in clasp, but I'll need some help for this one.
I was able to clasp login and clasp create with the latest version, thank you !
FYI, I still should replace the code inOnline() with true coz is-online module doesn't work with proxy. (mentioned in #336 )
@aakasaka I removed the check to isOnline if HTTP_PROXY/HTTPS_PROXY is present with 1.6.3.
Let me know if a proxy works out of the box now, so I can close this issue.
I simply tested clasp 1.6.3 with login, logout, status, clone, pull and push commands. It seems Ok now for http_proxy/https_proxy. Thanks for updating!
Hi, @grant , could you provide a quick step by step tutorial on how to set up the proxy and use the clasp? I have been trying hours on figuring out this issue even after reading this,long discussion. The error I got is still showing "Error retrieving access token: FetchError: request to https://oauth2.googleapis.com/token failed, reason: connect ETIMEDOUT xxx:443"
I solved this issue, as i had another problem here related to proxy - here is the story:
I am on windows in a very restricted corporate enterprise which has to use an http and https proxy.
We do have normal google services accessible in the browser.
Obviously 'clasp login' does not work without a proxy, it gives:
Error retrieving access token: FetchError: request to https://oauth2.googleapis.com/token failed, reason: connect ETIMEDOUT 216.58.212.202:443
(It does work if i disconnect my computer from corporate and connect to public internet)
So i defined these two env variables in cmd (you can also do it in git bash console, just replace "set" with "export"):
set HTTP_PROXY=http://proxy.mycompany.com:80
set HTTPS_PROXY=https://proxy.mycompany.com:80/
(our corporate proxy uses port 80 for both http and https !)
this is the error i got:
Error retrieving access token: FetchError: request to https://oauth2.googleapis.com/token failed, reason: write EPROTO EC110000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:355:
The solution to my problem was that our https proxy used an http address, so i fixed the set to the following :
set HTTPS_PROXY=http://proxy.mycompany.com:80](http://proxy.mycompany.com/)
(note the http:// and not https:// on the right hand side)
Activity
grant commentedon Jan 16, 2018
I'm not sure what this would change would entail.
Can you be more specific about repro steps, some links, and a more detailed proposal on what commands this would be needed for?
It looks like this request would want to add something like:
--proxy "socks5://127.0.0.1/"to every command.
Similar issue: ytdl-org/youtube-dl#402 (comment)
hanguokai commentedon Jan 16, 2018
Yes, clasp need to add
--proxyoption, like youtube-dl, curl, gcloud, npm, git, etc.http_proxyenvironment variable is the same meaning as--proxy, but detect by command if no --proxy option specified.I am using socks5 protocol, there are others like http, https.
grant commentedon Feb 20, 2018
@hanguokai Can you add proxy rule to the URL
googleapis.comso that everygoogleapis.comrequest is proxied?grant commentedon Mar 6, 2018
Pull requests are welcome.
I'm closing this since I don't see much demand for this feature. Will reopen if there's demand or more discussion.
HeavensBlade commentedon Mar 23, 2018
I would also like to see a proxy option.
Since I'm developing behind a corporate proxy I always need to activate my smartphone hotspot.
nepsilon commentedon Apr 27, 2018
I'm using clasp from a censored internet where all things Google are blocked and need the proxy feature. Using proxy environment variables doesn't work.
grant commentedon Apr 27, 2018
Why doesn't using proxy environment variables not work? Every request goes through
http://googleapis.com/.Does every application you use require a proxy feature?
hanguokai commentedon Apr 27, 2018
Aha, please look at the same issue for firebase command line tool firebase/firebase-tools#155 . Nearly 2 years and 81 comments! Under certain conditions, people can't connect internet directly. That's it.
nepsilon commentedon Apr 27, 2018
@grant Yes, all blocked domains and IP requires a VPN or proxy. It's very standard in places like China.
grant commentedon Apr 27, 2018
Unfortunately G Suite and many of Google's services are blocked in China. I can't solve that issue. I'm guessing the Firebase tool would probably prefer to not be blocked too to solve that linked issue.
I don't understand why environment variables don't work, do you really need every single tool you use to implement a custom
--proxyoption?Underneath it all, we use
googleapis. It supports a proxy (HTTP_PROXY,HTTPS_PROXY). Does that not work?To implement this feature, I'd need:
To be honest, I have no use for this feature and still don't understand why you can't use a proxy elsewhere in the tech stack.
valen22br commentedon Aug 20, 2018
Hello, I'm running through the same problem. I tried setting up my user variables with proxy settings, and I'm still receiving the error below:
Error retrieving access token: Error: connect ETIMEDOUT 172.217.18.170:443
Is there a workaround for this issue?
grant commentedon Aug 20, 2018
I'm in favor of adding a proxy option, but to be honest, I don't know how to run a proxy and I don't know why env variables don't work like in the
googleapisREADME:I did a bit more research.
proxyvariable to this line of code: https://github.com/google/clasp/blob/master/src/auth.ts#L40Then rebuild clasp and test it out, and it works, that'd be awesome. Then I can update clasp to include this proxy param.
This is the most upvoted issue, and it looks like user variables doesn't work, so I'm in favor of support this feature in
clasp, but I'll need some help for this one.12 remaining items
grant commentedon Aug 24, 2018
(I moved some off-topic comments to a separate thread to keep this about a proxy FR. See #297 (comment))
aakasaka commentedon Oct 3, 2018
It seems googleapis fixed the problem with proxy.
Could you please update the packages (googleapis and google-auth-library) to latest version?
grant commentedon Oct 4, 2018
I'm in the process of upgrading the packages.
grant commentedon Oct 4, 2018
Can you install the latest clasp, 1.6.1? LMK if it's fixed with the new
googleapismodule.@hanguokai @valen22br @aakasaka @HeavensBlade
aakasaka commentedon Oct 5, 2018
I was able to
clasp loginandclasp createwith the latest version, thank you !FYI, I still should replace the code
inOnline()withtruecozis-onlinemodule doesn't work with proxy. (mentioned in #336 )grant commentedon Oct 5, 2018
OK, thanks. I'll remove the
isOnlinefeature with #332 since it's not super useful and blocks proxy users. Sorry @arjun-rao!valen22br commentedon Oct 5, 2018
Tomorrow I will run some tests with a proxy configuration.
Thanks for the fix!
grant commentedon Oct 5, 2018
@aakasaka I removed the check to
isOnlineifHTTP_PROXY/HTTPS_PROXYis present with1.6.3.Let me know if a proxy works out of the box now, so I can close this issue.
hanguokai commentedon Oct 6, 2018
I simply tested clasp 1.6.3 with login, logout, status, clone, pull and push commands. It seems Ok now for
http_proxy/https_proxy. Thanks for updating!grant commentedon Oct 6, 2018
👍 Thanks for testing.
Closing this top clasp FR now!
zoudino commentedon May 6, 2021
Hi, @grant , could you provide a quick step by step tutorial on how to set up the proxy and use the clasp? I have been trying hours on figuring out this issue even after reading this,long discussion. The error I got is still showing "Error retrieving access token: FetchError: request to https://oauth2.googleapis.com/token failed, reason: connect ETIMEDOUT xxx:443"
thedrs commentedon Jan 10, 2023
I solved this issue, as i had another problem here related to proxy - here is the story:
I am on windows in a very restricted corporate enterprise which has to use an http and https proxy.
We do have normal google services accessible in the browser.
Obviously 'clasp login' does not work without a proxy, it gives:
Error retrieving access token: FetchError: request to https://oauth2.googleapis.com/token failed, reason: connect ETIMEDOUT 216.58.212.202:443
(It does work if i disconnect my computer from corporate and connect to public internet)
So i defined these two env variables in cmd (you can also do it in git bash console, just replace "set" with "export"):
set HTTP_PROXY=http://proxy.mycompany.com:80
set HTTPS_PROXY=https://proxy.mycompany.com:80/
(our corporate proxy uses port 80 for both http and https !)
this is the error i got:
Error retrieving access token: FetchError: request to https://oauth2.googleapis.com/token failed, reason: write EPROTO EC110000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:355:
The solution to my problem was that our https proxy used an http address, so i fixed the set to the following :
set HTTPS_PROXY=http://proxy.mycompany.com:80](http://proxy.mycompany.com/)
(note the http:// and not https:// on the right hand side)
Hope i helped others here too