Welcome to the troubleshooting guide for Azure Functions Dapr Extension. This guide is designed to help you address common issues and problems that may arise during the usage of Dapr Extension. Please follow the steps below to resolve any issues you encounter.
- Issue 1: Unable to find package Microsoft.Azure.WebJobs.Extensions.Dapr with version (>= 99.99.99)
- Issue 2: Dapr sidecar is not present
- Issue 3: Dapr app config error
Symptoms: When building the Azure Function Dapr Extension dotnet-isolated sample, you encounter an issue where it looks for the package Microsoft.Azure.WebJobs.Extensions.Dapr
with version (>= 99.99.99), which is not available in the global NuGet package.
== APP == /WorkerExtensions.csproj : error NU1102: Unable to find package Microsoft.Azure.WebJobs.Extensions.Dapr with version (>= 99.99.99)
== APP == WorkerExtensions.csproj : error NU1102: - Found 4 version(s) in nuget.org [ Nearest version: 0.17.0-preview01 ]
Possible Causes: The issue is caused by the dotnet language worker adding a reference to the NuGet package Microsoft.Azure.WebJobs.Extensions.Dapr
with an a version (99.99.99) in WorkerExtensions.csproj
. Once package reference is added to WorkerExtensions.csproj
, it always looks for above nuget package even though you are not referencing it in you dotnet-isolate azure function. This is a known issue in dotnet-language worker and should be fixed as part of this PR.
Resolution:
-
Generate the Package:
Build the Azure Function Dapr Extension repository from the root directory using the following command:
dotnet build --configfile nuget.config
This build step will create an
local-packages
folder in the root directory. -
Modify Global NuGet Configuration:
Next, you need to modify the global NuGet configuration file, which can be found at the following location based on your operating system:
Windows:
%appdata%\NuGet\NuGet.Config
macOS: Replace username with your username
/Users/username/.nuget/NuGet.config
Edit the NuGet.config file and add
nuget.local
param, replace<home_directory>
with your actual path:<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> <add key="nuget.local" value="<home_directory>/azure-functions-dapr-extension/local-packages" /> </packageSources> </configuration>
Preventive Measures: If you don't need to debug the extension, you should always use published nuget package
Symptoms: If you are utilizing Dapr bindings and triggers in Azure Functions, you might encounter an error message like the following:
Dapr sidecar is not present. Please see (https://aka.ms/azure-functions-dapr-sidecar-missing) for more information.
Possible Causes: This error typically occurs when Dapr is not properly enabled in your environment.
Resolution:
Enable Dapr in your application:
- If your Azure Function is deployed in Azure Container Apps (ACA), refer to the documentation here for instructions on enabling Dapr.
- If your Azure Function is deployed in Kubernetes, ensure that your deployment has the following annotations in its YAML configuration:
annotations: dapr.io/enabled: "true" dapr.io/app-id: "functionapp" # Only define port of Dapr triggers are included dapr.io/app-port: "3001"
- If you are running your Azure Function locally, make sure you are running the function app with Dapr. Execute the following command:
dapr run --app-id functionapp --app-port 3001 --resources-path ..\components\ -- func host start
Preventive Measures: To prevent this error, always ensure that Dapr is properly set up and enabled in your environment before using Dapr bindings and triggers with Azure Functions.
Symptoms: If you encounter the following error message:
The Dapr sidecar is configured to listen on port {portInt}, but the app server is running on port {appPort}. This may cause unexpected behavior. For more information, visit [this link](https://aka.ms/azfunc-dapr-app-config-error).
Possible Causes: This error occurs when using Dapr Triggers and not configuring the app port in Dapr settings for the ContainerApps properly.
Note: The Azure Function Dapr Extension starts an HTTP server on port 3001 when there is Dapr trigger in your Azure Function, you can configure this port using the DAPR_APP_PORT environment variable. If you provide an incorrect app_port value when running the Function app, it can lead to this problem.
Resolution:
Configure the app-port correctly: In your ContainerApp's Dapr settings,
- If you are using a Dapr Trigger in your code, make sure that the app port is set to 3001 or
DAPR_APP_PORT
if explicitly set as an environment variable for application. - If you are not using a Dapr Trigger in your code, make sure that the app port is not set. It should be empty.
Ensure that you provide the correct DAPR_APP_PORT value to Dapr in the Dapr configuration.
- In Azure Container Apps (ACA), specify it in Bicep as shown below:
DaprConfig: {
...
appPort: 3001
...
}
- In a Kubernetes environment, set the dapr.io/app-port annotation:
annotations:
...
dapr.io/app-port: "3001"
...
- For local development, make sure to provide --app-port when running the Function app with Dapr:
dapr run --app-id functionapp --app-port 3001 --resources-path ..\components\ -- func host start
Preventive Measures: To prevent this error, always configure the app-port parameter correctly in your Dapr setup.
This troubleshooting guide aims to help you resolve common issues and maintain a seamless experience while using Azure Functions Dapr Extension. If you encounter an issue that is not covered in this guide or need further assistance, please raise a GitHub issue.
We appreciate your use of Azure Functions Dapr Extension and value your feedback to help improve our service.