Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix functions server port assignment #674

Merged
merged 1 commit into from
Jan 8, 2020

Conversation

apuyou
Copy link
Contributor

@apuyou apuyou commented Jan 8, 2020

- Summary

This PR assigns a port for the functions server in the dev command, sets it in the config and then uses it when starting the functions server. Previously, duplicate logic could result in the functions server starting on a specific port and then the CLI waiting for it on another port. This would prevent startup of the whole dev environment (endless dots).

The port is elected as follow:

  • functionsPort option in netlify.toml if provided
  • 34567 otherwise

If the elected port is currently in use, a random port is assigned.

This fixes the following issue: #659

- Test plan

The test must be run in a context where the functions server is started. This requires a .functions directory with appropriate contents.

The code was tested with the following configuration:

  • no port specified in netlify.toml
  • no port specified in netlify.toml but port 34567 is busy
  • port 11111 specified in netlify.toml
  • port 11111 specified in netlify.toml but port 11111 is busy

- Description for the changelog

Fix function servers port assignment issue preventing netlify dev startup

- A picture of a cute animal (not mandatory but encouraged)
Puppy

Edit: removed #634 from fixed issues

@RaeesBhatti
Copy link
Contributor

Thanks for the PR @apuyou

@RaeesBhatti RaeesBhatti merged commit 89f90cd into netlify:master Jan 8, 2020
@apuyou apuyou deleted the apuyou/functionsPort branch January 8, 2020 01:32
@mrlubos
Copy link

mrlubos commented Jan 8, 2020

Nice one @apuyou, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants