Debugging Node (node-inspector) in the Azure emulator
One thing I ran into this week is trying to run node within the Azure emulator, giving me access to the emulated versions of Azure table storage, queues, and blob, while also having debugging running.
If you are familiar with the Azure Node.js SDK, you’ll know that you can launch your role using the Start-AzureEmulator Powershell command. Unfortunately, this command doesn’t seem to have any debugging options.
Fear not: there’s an easy way to get this up and running with node-inspector: you can open up ServiceDefinition.csdef, where you should see the following line:
<EntryPoint> <ProgramEntryPoint commandLine="node.exe .\server.js" setReadyOnProcessStart="true"/> </EntryPoint>
So if you already have node-inspector (if not, run “npm install node-inspector –g”), you can launch it with the “node-inspector” command, and then change this line in ServiceDefinition.csdef to be:
<EntryPoint> <ProgramEntryPoint commandLine="node.exe --debug-brk .\server.js" setReadyOnProcessStart="true"/> </EntryPoint>
Then run Start-AzureEmulator. Happy debugging!