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
{{ message }}
Repository navigation
Error occured while trying to proxy to: localhost:3000/hello #19
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
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?
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
:) i just did. no effect :)
same thing 504 bad gateway
*Cezar Neaga*
*m:* +43 676 4445906
*s:* cezarneaga
*w:* https://cezarneaga.eu ( https://cezarneaga.eu/ )
*a:* Hackenbergweg 51/4, 1190, Vienna, Austria
Incorporated as Cezar Neaga e.U. in Austria
Company Reg. - Reg. Zl.: 104443F18
MBA 180/002363/2009 | St. Nr: 208/7497
VAT: ATU66988511
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.
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/.
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.
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.
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.
My etc hosts file contain multiple domains pointed for
When the 504 - starts
I can use another domain in the list in the /etc/hosts file and the request will successfully be made to APACH!!!!
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
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.
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. :)
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.
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.
Activity
swyxio commentedon Jan 9, 2019
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?
cezarneaga commentedon Jan 9, 2019
am using nvm. have some other versions of node. but nothing else out of the ordinary
swyxio commentedon Jan 10, 2019
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
swyxio commentedon Jan 10, 2019
https://www.youtube.com/watch?v=3ldSM98nCHI
swyxio commentedon Jan 11, 2019
cezarneaga commentedon Jan 11, 2019
I followed the video too, and i get the same error :(
Also on lts:carbon
This is so weird.
swyxio commentedon Jan 11, 2019
this is gonna sound really stupid but have you tried restarting your computer
cezarneaga commentedon Jan 14, 2019
swyxio commentedon Jan 14, 2019
note that the proxy we set up is ONLY for proxying from
localhost:3000/.netlify/functions/hello(where your react app is running) tolocalhost:9000/.netlify/functions/hello(where your lambda server is running).localhost:3000/hellois not supported.cezarneaga commentedon Jan 14, 2019
i know. clicking on the button returns the 504
not accessing the /hello page
swyxio commentedon Jan 14, 2019
happy to reopen the issue if you wanna share a repro, i have no idea how else to help you.
grgcnnr commentedon Apr 1, 2019
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 9010don't forget to update your proxy config to match.
She-Codes commentedon Aug 30, 2019
I also wanted to add that I was getting the same 504 when I was trying to hit my netlify function. Configuring
http-proxy-middlewaredid not work for me, but adding"proxy": "http://localhost:8888/",to mypackage.jsonfile did. My React app is running onhttp://localhost:3000/and my Netlify functions running onhttp://localhost:8888/.swyxio commentedon Aug 30, 2019
at this point i really recommend using netlify dev so you dont have to configure all this gunk :)
She-Codes commentedon Aug 31, 2019
My next project I will definitely start out using
create-react-app-lambda. I'd addednetlify-lambdato an existing React project and was comparing the waycreate-react-app-lambdawas set up to try to get mine going. I'm new to Netlify and React but I finally got it going.mordechaim commentedon Aug 5, 2020
Happened to me when I forgot to put
http://but instead just typedlocalhost:9000vashisth00 commentedon Dec 22, 2020
Error occurred while trying to proxy request /api/video/thumbnail from localhost:3000 to http://localhost:5001/
Sucks
KostisPoly commentedon Feb 21, 2021
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.
RichardTMiles commentedon Nov 10, 2021
My team faces this issues somewhat frequently and a restart will (seem to*) solve it.
erfanSW commentedon Jan 26, 2022
I face this issue when I'm trying to proxy request from localhost:XXXX to localhost:YYYY
RichardTMiles commentedon Jun 4, 2022
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.
I can use another domain in the list in the
/etc/hostsfile and the request will successfully be made toAPACH!!!!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
// happy hacking
RichardTMiles commentedon Jun 26, 2022
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 usingtcp.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 error504. I changed the domain in my browser to another in my hosts also listed under127.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.RichardTMiles commentedon Jun 26, 2022
https://github.com/chimurai/http-proxy-middleware/blob/master/README.md#nodejs-17-econnrefused-issue-with-ipv6-and-localhost-705
RichardTMiles commentedon Jun 26, 2022
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
This solves // completes my research. Hopefully this info I've added here will help the next person. :)
aceamarco commentedon Jul 6, 2022
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.
shetty-nithin commentedon Oct 9, 2022
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.