Hello Jenna,
I got stuck at the first step :(
when I do : "netlify functions:invoke send-contact-email --no-identity"
I get the following error :
$ netlify functions:invoke send-contact-email --no-identity
ran into an error invoking your function
{ FetchError: request to http://localhost:8888/.netlify/functions/send-contact-email failed, reason: connect ECONNREFUSED 127.0.0.1:8888
at ClientRequest.<anonymous> (/usr/local/lib/node_modules/netlify-cli/node_modules/node-fetch/lib/index.js:1455:11)
at ClientRequest.emit (events.js:198:13)
at Socket.socketErrorListener (_http_client.js:392:9)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
message:
'request to http://localhost:8888/.netlify/functions/send-contact-email failed, reason: connect ECONNREFUSED 127.0.0.1:8888',
type: 'system',
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED' }
The ECONNREFUSED error indicates that it can't connect to where the function is hosted (in this case localhost:8888). Make sure that you have netlify dev running in another command line window so that the functions are accessible.
Your application is ready~! 🚀
➡ Port 5000 is taken; using 58057 instead
- Local: http://localhost:58057
────────────────── LOGS ──────────────────
.......
and when running netlify functions:invoke send-contact-email --no-identity
ran into an error invoking your function
FetchError: request to http://localhost:8888/.netlify/functions/send-contact-email failed, reason: connect ECONNREFUSED 127.0.0.1:8888
at ClientRequest.<anonymous> (/Users/nikos/.nvm/versions/node/v12.13.1/lib/node_modules/netlify-cli/node_modules/node-fetch/lib/index.js:1455:11)
at ClientRequest.emit (events.js:210:5)
at Socket.socketErrorListener (_http_client.js:406:9)
at Socket.emit (events.js:210:5)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
message: 'request to http://localhost:8888/.netlify/functions/send-contact-email failed, reason: connect ECONNREFUSED 127.0.0.1:8888',
type: 'system',
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED'```
Did you resolve this? I'm getting exactly the same issue trying to call a simple function using netlify dev. Have spent ages on it.
I used 'netlify.toml' to define functions="functions/"
Hi Steve - Did you get this ironed out? What's the error message you're seeing?
If it's the same as the one that Marie ran into
reason: connect ECONNREFUSED 127.0.0.1:8888
then make sure that you've started up your app with netlify dev first.
If it is started, check to see what port is being used. You should see a message that the server has started. There are 3 that are started - the app, the lambda server where your functions run, and a proxy server (which is a proxy to both of those), so be sure to look for the one that is for the proxy server. The message looks like this:
If that port is NOT 8888, then the netlify functions:invoke call will fail since it's looking for functions on port 8888.
It doesn't look like there is an option in the command line to specify a port here, so there are a couple of options: 1) Figure out what is using port 8888 and stop it so that this will work or 2) Add the following to your [dev] block in your netlify.toml file:
port = 4444 # Port that the proxy server will listen on
This will force it to use the port you tell it to use and netlify functions:invoke will also use that port.
Make sure to change 4444 to an unused port on your system.
Actually, it seems the lastest netlify-cli is broken. After a lot of head scratching I found this issue and intalled an old version and the problem went away
Hello Jenna,
I got stuck at the first step :(
when I do : "netlify functions:invoke send-contact-email --no-identity"
I get the following error :
$ netlify functions:invoke send-contact-email --no-identity
ran into an error invoking your function
{ FetchError: request to http://localhost:8888/.netlify/functions/send-contact-email failed, reason: connect ECONNREFUSED 127.0.0.1:8888
at ClientRequest.<anonymous> (/usr/local/lib/node_modules/netlify-cli/node_modules/node-fetch/lib/index.js:1455:11)
at ClientRequest.emit (events.js:198:13)
at Socket.socketErrorListener (_http_client.js:392:9)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
message:
'request to http://localhost:8888/.netlify/functions/send-contact-email failed, reason: connect ECONNREFUSED 127.0.0.1:8888',
type: 'system',
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED' }
Any tips on how to get ride of this error?
Hi Marie -
The
ECONNREFUSED
error indicates that it can't connect to where the function is hosted (in this case localhost:8888). Make sure that you havenetlify dev
running in another command line window so that the functions are accessible.Hope that helps!
Thanks for your quick reply. I had the netlify dev running in another command line, that's why I don't understand ^
When I run netlify dev I get
and when running
netlify functions:invoke send-contact-email --no-identity
Did you resolve this? I'm getting exactly the same issue trying to call a simple function using netlify dev. Have spent ages on it.
I used 'netlify.toml' to define functions="functions/"
Is this possibly a WIndows issue?
Hi Steve - Did you get this ironed out? What's the error message you're seeing?
If it's the same as the one that Marie ran into
reason: connect ECONNREFUSED 127.0.0.1:8888
then make sure that you've started up your app with
netlify dev
first.If it is started, check to see what port is being used. You should see a message that the server has started. There are 3 that are started - the app, the lambda server where your functions run, and a proxy server (which is a proxy to both of those), so be sure to look for the one that is for the proxy server. The message looks like this:
If that port is NOT 8888, then the
netlify functions:invoke
call will fail since it's looking for functions on port 8888.It doesn't look like there is an option in the command line to specify a port here, so there are a couple of options: 1) Figure out what is using port 8888 and stop it so that this will work or 2) Add the following to your
[dev]
block in yournetlify.toml
file:This will force it to use the port you tell it to use and
netlify functions:invoke
will also use that port.Make sure to change 4444 to an unused port on your system.
Actually, it seems the lastest netlify-cli is broken. After a lot of head scratching I found this issue and intalled an old version and the problem went away
github.com/netlify/cli/issues/659
Thanks for answering so quickly
Oh bummer! Glad you got it sorted though.