Cli: functionsPort in netlify.toml ignored?

Created on 22 Apr 2020  路  5Comments  路  Source: netlify/cli

- Do you want to request a _feature_ or report a _bug_?

Bug and feature

- What is the current behavior?

functionsPort setting in the netlify.toml file is ignored and gives standard port output:

Starting Netlify Dev with vue-cli
Waiting for localhost:4444.
Functions server is listening on 34567

- If the current behavior is a bug, please provide the steps to reproduce.

[dev]
  command = "yarn serve"
  functions = "./src/functions"
  publish = "public"
  targetPort = 4444
  port = 4445
  functionsPort = 4446
  NODE_ENV = "development"
  autoLaunch = false

[build]
  command = "yarn build"
  functions = "./src/functions"
  publish = "dist"
  NODE_ENV = "production"

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200
  force = false

- What is the expected behavior?

Functions server port should be set to 4446

- Local Environment Information
System: OS: macOS 10.15.2 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Binaries: Node: 13.13.0 - /var/folders/_d/vlvvhry57hq4lz7spf_d_p3m0000gn/T/yarn--1587509942282-0.9951844804289349/node Yarn: 1.22.4 - /var/folders/_d/vlvvhry57hq4lz7spf_d_p3m0000gn/T/yarn--1587509942282-0.9951844804289349/yarn npm: 6.14.4 - /usr/local/bin/npm Browsers: Chrome: 80.0.3987.163 Safari: 13.0.4

Most helpful comment

No, your netlify dev server should be running on 8888 by default if that port is available. If you want to force it to run on a certain port you can specify --port as flag or port option in netlify.toml [dev] section:

[dev]
    port = 8888

All 5 comments

We've recently removed functionsPort configurability to avoid confusion around different ports and their uses. You should not need to configure or access functionPort manually. netlify dev will automatically select a port, start the function and configure routing to it.

How can I know which port will be responding to my requests?

@ricvillagrana You should send your functions requests to the port for netlify dev. For example, if your netlify dev server is running on 8888. Your request URL will look something like http://localhost:8888/.netlify/functions/hello

So, I need to change the port on my code/env variables each time I re-run netlify dev? 馃

No, your netlify dev server should be running on 8888 by default if that port is available. If you want to force it to run on a certain port you can specify --port as flag or port option in netlify.toml [dev] section:

[dev]
    port = 8888
Was this page helpful?
0 / 5 - 0 ratings