JetBrains/azure-tools-for-intellij

Unable to launch Azure Functions locally in Rider 2024.2 + plugin v4.0.0

SergeySalinAtDataart opened this issue ยท 20 comments

Hello, today I have updated Rider to version 2024.2 and it updated Azure Toolkit plugin to version 4.0.0. After that, I was unable to launch my project with Azure functons because Rider marked previous configurations as broken with a title:
This configuration cannot be edited and message on the bottom panel:
Run Configuration Error: Broken configuration due to unavailable plugin or invalid configuration data.

I have tried to create a new Azure - Run Function App configuration but it now asks me for a launch profile and I have no idea where to get this launch profile. Apparently, Rider doesn't know too and just says "(Unknown)":
image

And without this launch profile functions won't start. If I ignore the warning about missing launch profile and press "Continue Anyway" it successfully builds the project but a popup with the following error appears:
"Can't run Azure Functions host. Unable to create .NET executable"

In the previous Rider version with Azure Toolkit v. 3.5 everything still works just fine

Hello. This is because your project is probably missing the launchSettings.json file. I will check if this requirement can be relaxed. As a workaround, you can add this file with, for example, such content.

{
  "profiles": {
    "FunctionApp1": {
      "commandName": "Project",
      "commandLineArgs": "--port 7217",
      "launchBrowser": false
    }
  }
}

Exact same errors as @SergeySalinAtDataart , upon upgrading to 2024.2 I can now no longer run any of the function configurations that I was able to prior to the upgrade :/

image

@wahyuen Yes, due to a major release we have some breaking changes and the old run configurations will no longer work.

Hello, @rafaelldi I have added the file that you've mentioned but it didn't help:
image
The launch profile is still (Unknown) and there's nothing else in the dropdown

launchSettings.json should be in the Properties folder. Here is an example:

image

@rafaelldi thanks! This actually helped to get a working configuration, but I still cannot launch functions in new Rider - after build and launch my console window is filled with the following error:

[2024-08-16T08:36:56.171Z] Error building configuration in an external startup class.
[2024-08-16T08:36:56.172Z] Error building configuration in an external startup class. Nova.Samples.Functions: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
[2024-08-16T08:36:57.483Z] A host error has occurred during startup operation 'c69fb05c-0c23-466d-8545-6fe5bc29025d'.
[2024-08-16T08:36:57.484Z] Microsoft.Azure.WebJobs.Script: Error building configuration in an external startup class. Nova.Samples.Functions: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
Value cannot be null. (Parameter 'provider')

I have tried to explicitly install the package using NuGet but with no success
In previous version of Rider functions are launched without any problems.

Could you please check if this is happening from the Rider or the func CLI? Here in the Run tool window should be the path to the func util. Could you run the same command as in Run tool window func.exe host start --pause-on-error --port 7070 manually from the project folder (where you have the host.json file).

image

I've picked the following command from the Run window:
C:\Users\SergeyS\.AzureToolsForIntelliJ\AzureFunctionsCoreTools\v4\4.83.0\func.exe host start --pause-on-error --port 7070
It restored projects and launched the same versions of Azure stuff:
image
I have tried running the same command from the terminal but the result was the same -- it didn't start.

I've checked that the old Rider uses the following command in Run:
C:\Users\SergeyS\.AzureToolsForIntelliJ\AzureFunctionsCoreTools\v0\4.84.0-inprocess\func.exe host start --pause-on-error

Thank you, I will check. I've created a separate issue for that #885.

I'm using Rider 2024.2.1 with Azure Toolkit for Rider 4.1.0 and having a Properties/launchSettings.json file. My old AzureFunctionsHost configurations are broken, as already discussed in this thread.

Adding a new AzureFunctionAppRun is possible, but it seems like the properties (ie. PROGRAM_PARAMETERS) are not properly visualised in the UI after saving them. (They are stored correctly in the workspace.xml file though)

Next to that, I can't run my Azure Function app locally via Rider because it breaks on a JSON comment character:

Unexpected JSON token at offset 2214: Expected quotation mark '"', but had '/' instead at path: $.Values.FUNCTIONS_WORKER_RUNTIME JSON input: .....onSchedule": "0 */1 * * * *", // every minute

Running the Function app via a terminal is possible (without the error above) and this is my current workaround via C:\Users\MyUser\.AzureToolsForIntelliJ\AzureFunctionsCoreTools\v4\4.83.0\func.exe host start --pause-on-error --port 7219

@RubenDelange What do you mean that properties are not properly visualised in the UI?

I can't run my Azure Function app locally via Rider because it breaks on a JSON comment character

I've created a separate ticket for that #900

@RubenDelange What do you mean that properties are not properly visualised in the UI?

When creating a new Azure - Run Function app:
image

Hit OK, then reopen the Run/Debug configurations modal window:
image

Function host arguments + Working directory values are not shown (but are present in the workspace.xml file)

@RubenDelange Thank you, I will check

@RubenDelange It's probably the same issue that the plugin doesn't allow comments in json files yet, so it throws an exception when deserializing local.settings.json. So that will be fixed too once this issue #900 is resolved.

This is still an issue in Rider 2024.2.7 and the version 4.3.0 of the plugin.

@kviknamorten Hi! Which one?

Hi, I've just updated Rider and its plugins, so I'm not exactly sure what caused the issue, but since then, I haven't been able to start a project and keep encountering the following exception: "Can't run Azure Functions host. No Azure Functions Core Tools information could be determined." However, I can still run functions using the command line without any problems.
image

UPD:
found solution #944 (comment)

@kviknamorten Hi! Which one?

@rafaelldi, hi! I that my comment was not clear. I was referring to the main issue of this thread that It's not possible to launch Azure Functions locally in Rider because I get the "Can't run Azure Function hos. No Azure Functions Core Tools information could be determined".

I'm running this on an MacBook Pro in Mac OS using the M3 chipset. There has been absolutely no issues with this setup until I updated to the latest version of both the plugin and the Rider IDE 2 days ago. I tried to manually install an older version of Rider and the plugin, but to no avail. I tried to install the latest version on another similar MacBook which has never had any JetBrains products nor this plugin before. Same issue there.

Update @rafaelldi, the fix @IliaShigera points to in #944 works, but the issue still persists for people who are unaware of the workaround.

Thank you to you both!

@kviknamorten Yes, this is a separate issue from the original one. Here you can find the full discussion #944