# ConnectionRefused on localhost! Frontend unable to connect to my backend

**URL:** <https://forum.dfinity.org/t/connectionrefused-on-localhost-frontend-unable-to-connect-to-my-backend/9357>\
**Category:** Programs & Applications\
**Created:** [December 6, 2021, 4:52am UTC](https://forum.dfinity.org/t/connectionrefused-on-localhost-frontend-unable-to-connect-to-my-backend/9357 "2021-12-06T04:52:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![designcoderepeat](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/designcoderepeat/32/3899_2.png) [@designcoderepeat](https://forum.dfinity.org/u/designcoderepeat)\
**Post date:** [December 6, 2021, 4:52am UTC](https://forum.dfinity.org/t/connectionrefused-on-localhost-frontend-unable-to-connect-to-my-backend/9357/1 "2021-12-06T04:52:28Z")

</div>

as the title says, since yesterday my localhost is also behaving weirdly.

```auto
Uncaught (in promise) Error: Server returned an error:
  Code: 504 (Gateway Timeout)
  Body: Error occured while trying to proxy to: localhost:8080/api/v2/canister/rrkah-fqaaa-aaaaa-aaaaq-cai/call

    at HttpAgent.call (index.js:134)
    at async caller (actor.js:174)
    at async HTMLButtonElement.<anonymous> (index.js:452)

```

logs from npm

```auto
[HPM] Error occurred while trying to proxy request /api/v2/status from localhost:8080 to http://localhost:8000 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /api/v2/canister/rrkah-fqaaa-aaaaa-aaaaq-cai/call from localhost:8080 to http://localhost:8000 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /api/v2/canister/rrkah-fqaaa-aaaaa-aaaaq-cai/call from localhost:8080 to http://localhost:8000 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)

```

is anyone else facing this issue?  
I have not configured the canister rrkah-fqaaa-aaaaa-aaaaq-cai anywhere

Why would the connection be refused in my local set up?

---

<div class="post-metadata">

**Author:** ![GLdev](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@GLdev](https://forum.dfinity.org/u/GLdev)\
**Post date:** [December 6, 2021, 8:23am UTC](https://forum.dfinity.org/t/connectionrefused-on-localhost-frontend-unable-to-connect-to-my-backend/9357/2 "2021-12-06T08:23:41Z")

</div>

Are you running an odd numbered node version (13-15-17)? I remember reading something similar on discord. Might want to check if you can upgrade / downgrade to an even version.

From the discord:

```auto
Kyle
 — 
12/03/2021
I think we've encountered that on non-stable Node.js versions. We support 12, 14, and 16

Kyle
 — 
12/03/2021
I think it's an issue with the http middleware that webpack depends on for proxies. There's nothing I could identify that would make it work on Node 17 when I was looking into it

```

---

<div class="post-metadata">

**Author:** ![Jesse](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jesse/32/37836_2.png) [@Jesse](https://forum.dfinity.org/u/Jesse)\
**Post date:** [December 31, 2021, 8:58pm UTC](https://forum.dfinity.org/t/connectionrefused-on-localhost-frontend-unable-to-connect-to-my-backend/9357/3 "2021-12-31T20:58:35Z")

</div>

I’m having this same issue. Did you ever find a solution?

---

<div class="post-metadata">

**Author:** ![Jesse](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jesse/32/37836_2.png) [@Jesse](https://forum.dfinity.org/u/Jesse)\
**Post date:** [December 31, 2021, 10:12pm UTC](https://forum.dfinity.org/t/connectionrefused-on-localhost-frontend-unable-to-connect-to-my-backend/9357/4 "2021-12-31T22:12:58Z")

</div>

i switched my node version from v17.0.1 to v16.3.1 and it did the trick!

---

<div class="post-metadata">

**Author:** ![shunichiro](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/shunichiro/32/4425_2.png) [@shunichiro](https://forum.dfinity.org/u/shunichiro)\
**Post date:** [March 1, 2022, 12:52pm UTC](https://forum.dfinity.org/t/connectionrefused-on-localhost-frontend-unable-to-connect-to-my-backend/9357/5 "2022-03-01T12:52:38Z")

</div>

Thanks for the solution.  
I also encountered the same problem with node version 17. when I lowered the node version to 16, the error went away.
