typescriptvisual-studio-codeazure-functionsazure-http-trigger

Cannot edit the code while debugging in Azure function using Typescript in VS code


I'm trying to write a http trigger using Typescript language. I have set up every thing while following Microsoft Azure Function Documentation. I used VS code for this. The thing is I cannot change the code while debugging. If I do that, It will print below message and stop the operation. Any help I would very appreciate.

enter image description here


[2023-03-06T14:01:50.764Z] Executed 'Functions.HttpTrigger' (Succeeded, Id=e727154c-3aa6-480f-bd8f-80117f8fe5dc, Duration=32847ms)
[2023-03-06T14:02:05.484Z] Waiting for the debugger to disconnect...
[2023-03-06T14:02:05.568Z] Debugger listening on ws://127.0.0.1:9229/2f31ec6f-83b3-454f-96d5-84fb64fbb2c2
[2023-03-06T14:02:05.570Z] For help, see: https://nodejs.org/en/docs/inspector
[2023-03-06T14:02:05.792Z] Worker process started and initialized.

 *  The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command func host start" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Note: Parallely, I used tsm -w command in vs code in build terminal for compile ts file to js file.


Solution

  • As you are following this MS Doc to create a JavaScript trigger durable functions, I tried it in my environment, and it worked as per your requirements.

    There is a Debug: option in VScode. You can start debugging and stop it on entry, and you can also utilize the multiple break points option to debug code in separate terminals with multiple changes and you can display it in multiple window screens to avoid confusion.

    You can go through with the VScode debugging doc for more relevant information.

    Activity function:

    index.js:

    module.exports = async  function (context) {
    return `HelloThere ${context.bindings.name}!`;
    };
    

    I started debugging using Debug: Start debug and stop on entry. I was making changes while the function was executing but the terminal is not exited as shown in the below image.

    enter image description here

    Orchestrator URL:

    localhost:7071/api/orchestrators/DurableFunctionsOrchestratorJS1

    enter image description here

    StatusQueryGetUri:

    enter image description here

    Even if I was debugging the activity function while making changes, the terminal would not exit if you used the start debug and stop on entry actions.

    enter image description here