Skip to content

Error occured while trying to proxy to: localhost:3000/hello #19

Closed

Description

@cezarneaga

i cannot seem to get it to work.
clean install, both with npm and yarn.

bad gateway 504 on all api calls
[HPM] Error occurred while trying to proxy request /hello from localhost:3000 to http://localhost:9000/ (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
node 10.15.0

Activity

  1. swyxio commented on Jan 9, 2019

    @swyxio
    Contributor

    hi,

    sorry i havent seen this error before. i'm on node 10.13.0 myself and it works fine. do you have any other environment/browser/OS situations that might be relevant to this case?

  2. cezarneaga commented on Jan 9, 2019

    @cezarneaga
    Author

    am using nvm. have some other versions of node. but nothing else out of the ordinary

  3. swyxio commented on Jan 10, 2019

    @swyxio
    Contributor

    no clue at all, sorry. i recommend you start with create-react-app, make sure that works, and then add netlify-lambda on top. i’ll record a video for you

  4. swyxio commented on Jan 10, 2019

    @swyxio
    Contributor
  5. swyxio commented on Jan 11, 2019

    @swyxio
  6. cezarneaga commented on Jan 11, 2019

    @cezarneaga
    Author

    I followed the video too, and i get the same error :(

    Also on lts:carbon

    This is so weird.

  7. swyxio commented on Jan 11, 2019

    @swyxio
    Contributor

    this is gonna sound really stupid but have you tried restarting your computer

  8. cezarneaga commented on Jan 14, 2019

    @cezarneaga
    Author
  9. swyxio commented on Jan 14, 2019

    @swyxio
    Contributor

    note that the proxy we set up is ONLY for proxying from localhost:3000/.netlify/functions/hello (where your react app is running) to localhost:9000/.netlify/functions/hello (where your lambda server is running). localhost:3000/hello is not supported.

  10. cezarneaga commented on Jan 14, 2019

    @cezarneaga
    Author

    i know. clicking on the button returns the 504
    not accessing the /hello page

  11. swyxio commented on Jan 14, 2019

    @swyxio
    Contributor

    happy to reopen the issue if you wanna share a repro, i have no idea how else to help you.

  12. grgcnnr commented on Apr 1, 2019

    @grgcnnr

    Resurrecting an old thread to hopefully help someone out 💀.

    Maybe you have a collision on port 9000. try running netlify-lambda somewhere else
    ie. netlify-lambda serve src/lambda-src/ --port 9010

    don't forget to update your proxy config to match.

  13. She-Codes commented on Aug 30, 2019

    @She-Codes

    I also wanted to add that I was getting the same 504 when I was trying to hit my netlify function. Configuring http-proxy-middleware did not work for me, but adding "proxy": "http://localhost:8888/", to my package.jsonfile did. My React app is running on http://localhost:3000/ and my Netlify functions running on http://localhost:8888/.

  14. swyxio commented on Aug 30, 2019

    @swyxio
    Contributor

    at this point i really recommend using netlify dev so you dont have to configure all this gunk :)

  15. She-Codes commented on Aug 31, 2019

    @She-Codes

    My next project I will definitely start out using create-react-app-lambda. I'd added netlify-lambda to an existing React project and was comparing the way create-react-app-lambda was set up to try to get mine going. I'm new to Netlify and React but I finally got it going.

  16. mordechaim commented on Aug 5, 2020

    @mordechaim

    Happened to me when I forgot to put http:// but instead just typed localhost:9000

  17. vashisth00 commented on Dec 22, 2020

    @vashisth00

    Error occurred while trying to proxy request /api/video/thumbnail from localhost:3000 to http://localhost:5001/

    Sucks

  18. KostisPoly commented on Feb 21, 2021

    @KostisPoly

    not sure if this is relevant but i had the same error all of a sudden.
    After some debugging a silent error in a switch statement on a specific route handle seems to have fixed this for me.

  19. RichardTMiles commented on Nov 10, 2021

    @RichardTMiles

    this is gonna sound really stupid but have you tried restarting your computer

    My team faces this issues somewhat frequently and a restart will (seem to*) solve it.

  20. erfanSW commented on Jan 26, 2022

    @erfanSW

    I face this issue when I'm trying to proxy request from localhost:XXXX to localhost:YYYY

  21. RichardTMiles commented on Jun 4, 2022

    @RichardTMiles

    Okay so I found some very strange behavior this past week regarding this issue. At this point I assume everyone having this issue is running the local dev env on MAC OS? I believe this to be a system level issue, but cannot say for certain.

    1. My etc hosts file contain multiple domains pointed for

    Screen Shot 2022-06-04 at 2 05 09 PM

    1. When the 504 - starts

    Screen Shot 2022-06-04 at 2 09 26 PM

    1. I can use another domain in the list in the /etc/hosts file and the request will successfully be made to APACH!!!!

    2. Pull out Wireshark and all I see is ack on the loopback

    I'm no networking expert so I'm pretty much done diving in at the moment.. hopefully YOU can take this research further! lol

    Screen Shot 2022-06-04 at 2 03 36 PM

    // happy hacking

  22. RichardTMiles commented on Jun 26, 2022

    @RichardTMiles

    Aight so I'm becoming a networking expert after this latest update; three restarts and 504 each time. I've learned to reduce my Wireshark parameter input to just Loopback: Io0, start, then filter using tcp.port == 8080 (the port my apache is running). From top to bottom we immediately see a grey then red status indication (lines 1 & 2 respectively). From here to the next red line (No. 271) would indicate our error 504. I changed the domain in my browser to another in my hosts also listed under 127.0.0.1. The green lines (No 781, 807, 869, 875) do represent successful interprocess communication on this attempt. This obviously leads us to note the Source and Destination ::1 vs 127.0.0.1. This is our cause.

    Screen Shot 2022-06-26 at 12 41 38 PM

  23. RichardTMiles commented on Jun 26, 2022

    @RichardTMiles

    copied from here..

    In react v18 the behavior has changed to allow DNS to resolve ipv4 or ipv6 in any order, ie use first provided by OS. With macOs 12.4 (21F79) I believe ipv6 is the default regardless of order provided in your hosts file. This may have more or less been random, chosen at restart, but the links provided go into this in more detail.

    My apache configuration was not setup to receive traffic from ipv6. Adding the listener as follows and restarting apache fixed this issue without a restart.

    httpd.conf

    Listen 0.0.0.0:8080
    Listen [::1]:8080
    

    This solves // completes my research. Hopefully this info I've added here will help the next person. :)

  24. aceamarco commented on Jul 6, 2022

    @aceamarco

    I've been reading through the thread and none of the solutions offered so far have fixed this issue for me — did anyone else come across another solution for this? I'm trying to proxy localhost:8081 to localhost:4000.

  25. shetty-nithin commented on Oct 9, 2022

    @shetty-nithin

    im trying to connect my local host client to deployed api, im getting an error which says "Error occurred while trying to proxy: localhost:3000/v1/auth/signin".
    module.exports = (app) => { app.use( '/v1', createProxyMiddleware({ target: "https://aqueo.herokuapp.com/netlify/api/v1"}) ) }

    But if i change the target from deployed address to local address its working fine. Not sure why deployed address is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions