Skip to content

Commit 126a54c

Browse files
Merge pull request #263083 from v-jaswel/aca/v-jaswel_20240111_dapr
[Azure Functions] Add troubleshooting info
2 parents 16e133c + a8c8bb8 commit 126a54c

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

articles/azure-functions/functions-bindings-dapr.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,73 @@ Learn how to use the Dapr Extension for Azure Functions via the provided samples
260260

261261
::: zone-end
262262

263+
## Troubleshooting
264+
265+
This section describes how to troubleshoot issues that can occur when using the Dapr extension for Azure Functions.
266+
267+
### Ensure Dapr is enabled in your environment
268+
269+
If you're using Dapr bindings and triggers in Azure Functions, and Dapr isn't enabled in your environment, you might receive the error message: `Dapr sidecar isn't present. Please see (https://aka.ms/azure-functions-dapr-sidecar-missing) for more information.` To enable Dapr in your environment:
270+
271+
- If your Azure Function is deployed in Azure Container Apps, refer to [Dapr enablement instructions for the Dapr extension for Azure Functions](../azure-functions/functions-bindings-dapr.md#dapr-enablement).
272+
273+
- If your Azure Function is deployed in Kubernetes, verify that your [deployment's YAML configuration](https://github.com/azure/azure-functions-dapr-extension/blob/master/deploy/kubernetes/kubernetes-deployment.md#sample-kubernetes-deployment) has the following annotations:
274+
275+
```YAML
276+
annotations:
277+
...
278+
dapr.io/enabled: "true"
279+
dapr.io/app-id: "functionapp"
280+
# You should only set app-port if you are using a Dapr trigger in your code.
281+
dapr.io/app-port: "<DAPR_APP_PORT>"
282+
...
283+
```
284+
285+
- If you're running your Azure Function locally, run the following command to ensure you're [running the function app with Dapr](https://github.com/azure/azure-functions-dapr-extension/tree/master/samples/python-v2-azurefunction#step-2---run-function-app-with-dapr):
286+
287+
```bash
288+
dapr run --app-id functionapp --app-port <DAPR_APP_PORT> --components-path <COMPONENTS_PATH> -- func host start
289+
```
290+
291+
### Verify app-port value in Dapr configuration
292+
293+
The Dapr extension for Azure Functions starts an HTTP server on port `3001` by default. You can configure this port using the [`DAPR_APP_PORT` environment variable](https://docs.dapr.io/reference/environment/).
294+
295+
If you provide an incorrect app port value when running an Azure Functions app, you might receive the 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).` To resolve this error message:
296+
297+
1. In your container app's Dapr settings:
298+
299+
- If you're using a Dapr trigger in your code, verify that the app port is set to `3001` or to the value of the `DAPR_APP_PORT` environment variable.
300+
301+
- If you're _not_ using a Dapr trigger in your code, verify that the app port is _not_ set. It should be empty.
302+
303+
1. Verify that you provide the correct app port value in the Dapr configuration.
304+
305+
- If you're using Azure Container Apps, specify the app port in Bicep:
306+
307+
```bash
308+
DaprConfig: {
309+
...
310+
appPort: <DAPR_APP_PORT>
311+
...
312+
}
313+
```
314+
315+
- If you're using a Kubernetes environment, set the `dapr.io/app-port` annotation:
316+
317+
```
318+
annotations:
319+
...
320+
dapr.io/app-port: "<DAPR_APP_PORT>"
321+
...
322+
```
323+
324+
- If you're developing locally, verify you set `--app-port` when running the function app with Dapr:
325+
326+
```
327+
dapr run --app-id functionapp --app-port <DAPR_APP_PORT> --components-path <COMPONENTS_PATH> -- func host start
328+
```
329+
263330
## Next steps
264331

265332
[Learn more about Dapr.](https://docs.dapr.io/)

0 commit comments

Comments
 (0)