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

Routing/URL matching precedence is ignored #482

Open
danielniccoli opened this issue Jan 29, 2024 · 0 comments
Open

Routing/URL matching precedence is ignored #482

danielniccoli opened this issue Jan 29, 2024 · 0 comments
Labels
Enhancement Feature requests. P3 Priority 3

Comments

@danielniccoli
Copy link

danielniccoli commented Jan 29, 2024

🐛 Describe the bug

A durable function that uses routing or URL matching does not respect the ASP.NET routing precedence. As per https://learn.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-8.0#url-matching, a specific route takes precedence:

The route precedence is computed based on a more specific route template being given a higher priority. For example, consider the templates /hello and /{message}:

When used in Azure Durable Functions, the specific routes are never used. WIth the below repro steps, function http_start_specific() is never reached, even when requesting /orchestrators/specific/something.

Steps to reproduce

  1. Create a durable function with the following function_app.py:
import azure.functions as func
import azure.durable_functions as df

myApp = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)


# An HTTP-Triggered Function with a Durable Functions Client binding
@myApp.route(route="orchestrators/{functionName}/{*path}")
@myApp.durable_client_input(client_name="client")
async def http_start_generic(req: func.HttpRequest, client):
    function_name = req.route_params.get("functionName")
    if function_name == "specific_orchestrator":
        return "You called the specific orchestrator, but the generic orchestrator processed the request!"
    else:
        return "You called the generic orchestrator."


@myApp.route(route="orchestrators/specific/{*path}")
@myApp.durable_client_input(client_name="client")
async def http_start_specific(req: func.HttpRequest, client):
    return "You called the specific orchestrator."
  1. Send an http request to http://localhost:7071/api/orchestrators/generic_orchestrator/something
  2. Send an http request to http://localhost:7071/api/orchestrators/specific_orchestrator/something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Feature requests. P3 Priority 3
Projects
None yet
Development

No branches or pull requests

2 participants