Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Commit

Permalink
Merge pull request #79 from netlify/get-functions-port
Browse files Browse the repository at this point in the history
Make sure we always choose a free port for function server
  • Loading branch information
swyxio authored Apr 4, 2019
2 parents 56e3069 + f604949 commit 5c3eae9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/commands/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ function startDevServer(settings, log, error) {
server.start(function() {
log("Server listening to", settings.proxyPort);
});
return;
} else {
log(`Starting netlify dev with ${settings.type}`);
const ps = execa(settings.command, settings.args, {
Expand Down Expand Up @@ -180,8 +179,13 @@ class DevCommand extends Command {
startDevServer(settings, this.log, this.error);

if (functionsDir) {
const fnSettings = await serveFunctions({ ...settings, functionsDir });
settings.functionsPort = fnSettings.port;
const functionsPort = await getPort({ port: 34567 });
const fnSettings = await serveFunctions({
...settings,
port: functionsPort,
functionsDir
});
settings.functionsPort = functionsPort;
}

const proxyUrl = await startProxy(settings, addonUrls);
Expand Down

0 comments on commit 5c3eae9

Please sign in to comment.