Azure-functions-core-tools: Debugging multiple func projects causes incorrect local.settings.json to be loaded

Created on 7 Nov 2017  路  4Comments  路  Source: Azure/azure-functions-core-tools

Is doing debugging multiple Azure Function projects with Visual Studio supported? I've configured 4 separate function projects to start up, and while it usually works now that I've forced each to use a different port, I sometimes see strange behavior, including func.exe seemingly picking up the wrong local.settings.json file.

For example, let's say I have functions A through D, and all four are set as startup projects for debugging in Visual Studio.

Sometimes when I start debugging, function D will seem to have settings from function A, even though it is running the code for function D.

I also occasionally see errors like this:

Error: listen EADDRINUSE :::5858
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at Agent.Server._listen2 (net.js:1258:14)
at listen (net.js:1294:10)
at net.js:1404:9
at _combinedTickCallback (internal/process/next_tick.js:83:11)
at process._tickCallback (internal/process/next_tick.js:104:9)

And like this:
Error updating ConfigurationManager.AppSettings

And a few other random errors that make me think there's somehow a race condition between the processes.

Please let me know if there are any other details that I can provide.

Most helpful comment

I was just provided a workaround for issue on the VS function app tooling repository for a similar issue https://github.com/Azure/Azure-Functions/issues/584

To fix the issue add the command line switch --nodeDebugPort 5859 to your launching of func host to set the port. If you are getting other errors about the port 7071 being in use you need to specify the port for the host in your local.settings.json that should be used instead.

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "AzureWebJobsDashboard": ""
  },
  "Host": {
    "LocalHttpPort": 7072,
    "CORS": "*"
  }
}

If you are launching from within visual studio you need to project -> properties -> Debug, then under Application arguments you need to pass in a value that looks similar to host start --pause-on-error --nodeDebugPort 5859, Visual Studio does not currently respect the Host.LocalHttpPort setting when starting the debugger unless you use host start --pause-on-error as an argument.

All 4 comments

I was just provided a workaround for issue on the VS function app tooling repository for a similar issue https://github.com/Azure/Azure-Functions/issues/584

To fix the issue add the command line switch --nodeDebugPort 5859 to your launching of func host to set the port. If you are getting other errors about the port 7071 being in use you need to specify the port for the host in your local.settings.json that should be used instead.

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "AzureWebJobsDashboard": ""
  },
  "Host": {
    "LocalHttpPort": 7072,
    "CORS": "*"
  }
}

If you are launching from within visual studio you need to project -> properties -> Debug, then under Application arguments you need to pass in a value that looks similar to host start --pause-on-error --nodeDebugPort 5859, Visual Studio does not currently respect the Host.LocalHttpPort setting when starting the debugger unless you use host start --pause-on-error as an argument.

Thanks, I'll give that a shot!

It would be really nice if --nodeDebugPort setting was added to the "Host" configuration setting, then at least we wouldn't have configuration sprinkled throughout the solution / IDE.

Closing, please try this in v2 or v3 version of the core tools

Was this page helpful?
0 / 5 - 0 ratings

Related issues

frozenbubble picture frozenbubble  路  4Comments

lastcoolnameleft picture lastcoolnameleft  路  4Comments

christopheranderson picture christopheranderson  路  6Comments

jerimiahwelch picture jerimiahwelch  路  4Comments

Kaushik27 picture Kaushik27  路  5Comments