-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Azure/azure-functions-nodejs-worker
#692Labels
GA blockerbreakingenhancementv4 🚀We no longer use this label since v4 is now the default model.We no longer use this label since v4 is now the default model.
Milestone
Description
Since the developer provides the name of a Function in the new programming model, rather than it coming from the file system, it's possible to register multiple Functions with the same name:
import { app } from "@azure/functions";
app.get("todo", () => {});
app.post("todo", () => {});In this example you're expecting that todo is the route (which it would be set as) and we have registered different verbs on the same route. But since the first argument is both name and route, only the last one is registered.
I see there being two options:
- We take the user-provided name and add some additional context information, e.g.:
http-todo-get, where it's<trigger>-<name>-<additional info if required>. - We either raise an error if a duplicate name is detected or warn in logs that only the last registered with that name will be registered.
Option 1 does a better job at enforcing unique names but with the drawback that it won't be as obvious in the logs until people realise the name they provided is only part of it. Option 2 avoids "magic naming" but with the drawback of a runtime warning or error, which might not be the ideal DX.
Metadata
Metadata
Assignees
Labels
GA blockerbreakingenhancementv4 🚀We no longer use this label since v4 is now the default model.We no longer use this label since v4 is now the default model.