Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Functions requirements for paths clash with SWA, DevOps deployment task fails silently #1508

Open
jparta opened this issue Jul 3, 2024 · 0 comments

Comments

@jparta
Copy link

jparta commented Jul 3, 2024

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 Azure/azure-functions-python-worker#1310.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant