usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
25.06k stars 1.14k forks source link

ECONNREFUSED error when using localhost with proxy endpoints #1423

Open Lukenickerson opened 7 months ago

Lukenickerson commented 7 months ago

I'm running and testing a local proxy server meant to function as an API gateway. It is built in nodejs express v4.18.2 and http-proxy-middleware v2.0.6, and is currently as simple as possible.

When hitting the proxied auth endpoint I'm seeing this error:

Error invoking remote method 'send-http-request': Error: connect ECONNREFUSED ::1:443

Related to https://github.com/usebruno/bruno/issues/124 but obviously different.

Details

Tests

Since the "dog" endpoint works, but "auth" does not, I admit there is likely something unusual happening with my target server. But it is disconcerting that Bruno acts different from Postman and the browser.

martinsefcik commented 7 months ago

@Lukenickerson Do you have http_proxy or https_proxy defined as environment variable in Windows?

Lukenickerson commented 7 months ago

@martinsefcik - No, I do not. Are they required by Bruno (but not Postman)?

clemarc commented 7 months ago

Experiencing the same issue here, when running our application locally we have a WebPack server for our react application and proxying

From our pre-script we are trying to generate an OAuth bearer token from the pre-request script but it fails if we hit the webpack proxy but works if

For now we are bypassing the proxy and overall I don't think it is a big issue for us. The webpack proxy is mostly here to share a session cookie when logging in app (cookies are not shared if the port is different)

Reading the docs I haven't really found a way to try to debug and understand the issue more but let me know if you need anything that can help debug.

Details

macOS Sonoma (14.2.1 Bruno desktop app v1.6.1

Aarbel commented 1 month ago

this may be useful, a lot of people have this ECONNREFUSED error with proxies on mac (even with ngrok)

gajakannan commented 1 month ago

Windows 11, just installed bru cli and have the bruno ui for few months

I am getting same error in cli image

Interestingly, the same route works from bruno ui image

gajakannan commented 1 month ago

Am I the only one that have the above issue that bruno tests work from gui but fails from cli... Am I missing something?

jkwold commented 1 day ago

On Windows 10 running with Bruno 1.28 and a GET http://localhost:someport/... in bruno itself that works yet as noted cmdline bru 1.26.2

bru run somebru.bru --env "myenv"
Running Request

somebru (connect ECONNREFUSED ::1:8080)

hacking the GET URL so instead of localhost it specifically calls out IPv4 127.0.0.1 then that works both in Bruno and cmdline bru

looks like localhost is interpreted as the fine IPv6 ::1 in bru and not so in Bruno, tho haven't tried a procmon or similar to see if that's really true