Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attach to debugger for Azure Functions from Rider on Mac

Just wondering if anyone has managed to attach and debug an Azure Functions app using JetBrains Rider?

There only seems to be 2 debug options for Azure Functions

--debug VS 
--debug VsCode

Not sure if Rider can attach to these, I can't find much on this. So if anyone else has succeeded please let me know how/if it can be done.

Thanks.

like image 242
Lenny D Avatar asked Sep 26 '18 15:09

Lenny D


People also ask

How do I run Azure function in rider?

Let's find out how easy it is to run a Function locally. The first step is to install the plugin that will enable support for Azure Functions. Go to the Settings (ctrl+alt+s) > Plugins tab and search for "Azure Toolkit for Rider" and install it.

How do I connect to Azure function?

Run the function locallyUnder Functions, expand Local Project > Functions. Right-click (Ctrl-click on Mac) the HttpExample function and select Execute Function Now.... In the Enter request body, you see the request message body value of { "name": "Azure" } . Press Enter to send this request message to your function.


2 Answers

No, this is not possible to date (4. Oct. 2018): According to the Rider online bug report (This is not implemented yet, please feel free to vote for https://youtrack.jetbrains.com/issue/RIDER-1256) this is not solved, yet.

like image 65
Peter Branforn Avatar answered Oct 19 '22 07:10

Peter Branforn


The above issue has now been resolved, however it still does not support Azure Functions.

However I did find this, please note this appears to be windows only, not Mac.

https://github.com/JetBrains/azure-tools-for-intellij/issues/78#issuecomment-439313762

Install the Azure functions command line tools using NPM (https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local)

Add a file Properties/launchSettings.json, with the following contents (tailored to your project):

{
  "profiles": {
    "functions": {
      "commandName": "Executable",
      "executablePath": "dotnet",
      "commandLineArgs": "%APPDATA%\\npm\\node_modules\\azure-functions-core-tools\\bin\\func.dll host start --port 7071 --pause-on-error",
      "environmentVariables": {
        "AZURE_FUNCTIONS_ENVIRONMENT": "Development",
        "AzureWebJobsStorage": "UseDevelopmentStorage=true"
      }
    }
  }
}

Run the launch profile, and wait for the functions host to say it is running In Rider, attach to the process using Run | Attach to Process.... Find the process that is running dotnet ... func.dll:

like image 37
Lenny D Avatar answered Oct 19 '22 08:10

Lenny D