Skip to content

Remote Debugging for Azure Functions

Hanxiao Liu edited this page Nov 2, 2022 · 3 revisions

Remote Debugging for Azure Functions

Enable Remote Debugging

When enable remote debugging for Java functions in Azure toolkit, the following configurations of the selected Function App will be changed:

  • use32BitWorkerProcess will be set to false
  • webSocketsEnabled will be set to true
  • the following Application Settings will also be modified
    • HTTP_PLATFORM_DEBUG_PORT: 8898 (This will not change if you have an existing value)
    • JAVA_OPTS: -Djava.net.preferIPv4Stack=true -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8898 HTTP_PLATFORM_DEBUG_PORT: ${HTTP_PLATFORM_DEBUG_PORT}
      • If you did not set JAVA_OPTS before, we will add the above options to your app settings, otherwise, we will just add up the missing part.

Disable Remote Debugging

When disable remote debugging for Java functions in Azure toolkit, the following app settings will be modified or removed

  • HTTP_PLATFORM_DEBUG_PORT
  • JAVA_OPTS
    • -Djava.net.preferIPv4Stack=true, -Xdebug, -Xrunjdwp:* will be removed from your JAVA_OPTS, if there is no more configuration left, JAVA_OPTS will also be removed from your app settings

Known Issues

Remote debugging could only be enabled for one Function App in one app service plan

To enable remote debugging, toolkit will enable jdwp with port 8898 in function host, and function in same service plan share same environment. If remote debugging is enabled for multi-functions in same app service plan, there will be port conflicts which will break the function host. If you want to debug multi-function apps in same service plan, please update HTTP_PLATFORM_DEBUG_PORT and JAVA_OPTS manually to avoid the conflicts.