Problems to use expo-cli when using proxy

Hi guys,
I’m facing problems when trying to login or run an expo app on android simulator(i’m using android studio). When I’m using an ordinary wifi everything works correctly, however I’m using a wifi with proxy configuration now, basically my celphone get the wifi signal and create a wifi hotspot for my laptop to connect in that network and I have to configure proxy in my laptop here before using it. Npm and node works correctly however when I try to run expo start and after that click on “Run on android device/simulator” it shows the following error:
WARNING
Fetching the user profile failed
WARNING
socket hang up

I’m using Debian 9 (linux) as my SO.
I’ve already tried to set the env variables HTTP_PROXY and HTTPS_PROXY but it’s not working yet. As my proxy has the address 192.168.49.1 and the port 8282, I put on these two variables this:
HTTP_PROXY=“http://192.168.49.1:8282
HTTPS_PROXY=“http://192.168.49.1:8282

Could anyone help me please?
thank you

Try using lowercase environment variable names:

export http_proxy="http://192.168.49.1:8282"
export https_proxy="http://192.168.49.1:8282"

Hello Wodin, Thank you for your answer. Unfortunatelly I tried using lowercase, however it is not working yet. I put it in the .bashrc file , and did the command “source .bashrc” to create the env variables however even doing it, it is not working.

Hi @igormsnogueira

It’s strange that npm works, but expo doesn’t. In the same shell that you were trying to run expo in, does the following work?

http_proxy="http://192.168.49.1:8282" https_proxy="http://192.168.49.1:8282" expo login

I was going to ask if running with EXPO_DEBUG=true set gives you any more information, but unfortunately it doesn’t seem to in this case. After I set http_proxy and https_proxy to invalid values, if I run EXPO_DEBUG=true expo login I get the following:

$ EXPO_DEBUG=true expo login
Fetching the user profile failed
socket hang up

What does the following give you?

sh -c 'env | grep -i proxy'

Also, in case it helps, can you please post the output of expo diagnostics?

Hello Wodin,
yeah I’m struggling with that for days.

I’m attatching here all screenshots of my console testing those commands that you asked me to test.
Testing the proxy command sh -c ‘env | grep -i proxy’
proxies
there is my expo diagnostics

This is me running
http_proxy="http://192.168.49.1:8282" https_proxy="http://192.168.49.1:8282" expo login

And when I run EXPO_DEBUG=true expo login I have the same result that you had.

Showing that npm is working, I just installed express in a random folder.

Thanks for helping bro.

I’m starting to run out of ideas :confused:

What does the following give you? I set http_proxy(s) to ports on localhost that nothing is listening on. As you can see expo tried to connect to the https_proxy and nothing else:

$ http_proxy=http://127.0.0.1:9999 https_proxy=http://127.0.0.1:9998 strace -econnect expo login
syscall_318(0x37e7510, 0x20, 0, 0x7fffffff, 0x71, 0) = 0x20
syscall_332(0xffffff9c, 0x7ffc31b675f8, 0, 0xfff, 0x7ffc31b671d0, 0x7ffc31b672f0) = -1 (errno 38)
connect(22, {sa_family=AF_INET, sin_port=htons(9998), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
Fetching the user profile failed
connect ECONNREFUSED 127.0.0.1:9998
? Username/Email Address: --- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=6793, si_uid=1000} ---
+++ killed by SIGINT +++

By the way, you can paste the output as text and just add a line above and below the output with three back ticks to mark it as preformatted text. Like this:

```
output here
```

Trying to create a new project in EXPO as… expo init my-project. Next I choose new blank template and next is the error… cannot find module ‘resolve’.
Pls help. Many thanks

running this comand, I had the same result:

http_proxy=http://127.0.0.1:9999 https_proxy=http://127.0.0.1:9998 strace -econnect expo login
syscall_332(0xffffff9c, 0x7ffea9782708, 0, 0xfff, 0x7ffea97822e0, 0x7ffea9782400) = -1 (errno 38)
connect(20, {sa_family=AF_INET, sin_port=htons(9998), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
Fetching the user profile failed
connect ECONNREFUSED 127.0.0.1:9998

By the way, thank you for your support, unfortunately I have no idea why this is happening.

Hi @zapper41. That looks like a completely different problem. I suggest you post a new topic rather than a comment on this one. When you do, include the output of expo diagnostics.

Hi @igormsnogueira. That output shows that expo is using the https_proxy environment variable, at least for the first connect.

Maybe try the same command, but with your proxy settings to see if there’s a later connect that is ignoring the proxy settings.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.