Azure Functions requirements for paths clash with SWA, DevOps deployment task fails silently
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Let's set the following setting in Azure Functions `host.json`:
```
"extensions": {
"http": {
"routePrefix": ""
}
}
```
We get the following error after the Oryx build run by the Azure DevOps task `AzureStaticWebApp@0`:
> `Error in processing api build artifacts: the host.json file cannot specify a http.routePrefix value other than 'api'.`
This would be fine, if it weren't for the fact that setting `"routePrefix": "api"` results in the following error when testing locally with `swa start`:
> `Microsoft.AspNetCore.Routing: An error occurred while creating the route with name 'http_app_func' and template 'api//{*route}'. Microsoft.AspNetCore.Routing: The route template separator character '/' cannot appear consecutively. It must be separated by either a parameter or a literal value. (Parameter 'routeTemplate'). Microsoft.AspNetCore.Routing: The route template separator character '/' cannot appear consecutively. It must be separated by either a parameter or a literal value.`
The above error is shown locally, but the deployment completes on DevOps using `AzureStaticWebApp@0`, and the pipeline run was "successful". However, the API is not in fact deployed, likely because the function registration failed. There is no logging by the task which would indicate success or failure in finding functions to register. The task fails silently.
This happens specifically when using `azure.functions.AsgiFunctionApp`. I'm using it to (hopefully) deploy my FastAPI backend to my SWA resource.
Is this a known issue? Are there reasonable workarounds?
This was brought up in https://github.com/Azure/azure-functions-python-worker/issues/1310.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.