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

Commit 5c3eae9

Browse files
authored
Merge pull request #79 from netlify/get-functions-port
Make sure we always choose a free port for function server
2 parents 56e3069 + f604949 commit 5c3eae9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/commands/dev/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ function startDevServer(settings, log, error) {
9696
server.start(function() {
9797
log("Server listening to", settings.proxyPort);
9898
});
99-
return;
10099
} else {
101100
log(`Starting netlify dev with ${settings.type}`);
102101
const ps = execa(settings.command, settings.args, {
@@ -180,8 +179,13 @@ class DevCommand extends Command {
180179
startDevServer(settings, this.log, this.error);
181180

182181
if (functionsDir) {
183-
const fnSettings = await serveFunctions({ ...settings, functionsDir });
184-
settings.functionsPort = fnSettings.port;
182+
const functionsPort = await getPort({ port: 34567 });
183+
const fnSettings = await serveFunctions({
184+
...settings,
185+
port: functionsPort,
186+
functionsDir
187+
});
188+
settings.functionsPort = functionsPort;
185189
}
186190

187191
const proxyUrl = await startProxy(settings, addonUrls);

0 commit comments

Comments
 (0)