DEV Community

loading...

Discussion on: Sending Email with Netlify Functions

stevealee profile image
SteveALee

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?

Thread Thread
jennapederson profile image
Jenna Pederson Author

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:

Proxy server

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.

Thread Thread
stevealee profile image
SteveALee

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

Thread Thread
jennapederson profile image
Jenna Pederson Author

Oh bummer! Glad you got it sorted though.