You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect to have 2 functions running.
But when running locally with func start I get only one.
Here is the logs:
Azure Functions Core Tools
Core Tools Version: 4.0.5198 Commit hash: N/A (64-bit)
Function Runtime Version: 4.21.1.20667
[2023-05-31T12:35:16.018Z] Worker process started and initialized.
Functions:
users: [PATCH] http://localhost:7071/api/users
For detailed output, run func with --verbose flag.
[2023-05-31T12:35:20.977Z] Host lock lease acquired by instance ID '00000000000000000000000023AC63E5'.
It looks like the second one is overriding the first one.
I could use app.http(...) but it would be far easier if the express like way if doing things was working out of the box.
Do you know of some way I could achieve this ?
For now this isn't supported, but we'll keep it open as a feature request. The recommended workaround is to use app.http(...) as you mentioned.
For true support, we would need a fix on the host. I don't remember the exact error, but I had a prototype that allowed this on the Node.js side but the host was still throwing errors. It doesn't allow two functions to affect one route.
We might be able to hack something together on the Node.js side if we collect the separate method functions and pass them to the host as one function. The main downside is the settings (like authLevel) would need to match.
ejizba
changed the title
v4 multiple functions with the same name are overriding each other
v4 allow registering separate http methods to the same route
May 31, 2023
Since you have different handlers to deal with each of the request, adding methods array will work and you know which handler to call based on the method being called via the request object. I would have done something like this.
Hello,
With v4 nodejs typescript, I'm trying to create two functions with the same name but different methods. Like this:
I would expect to have 2 functions running.
But when running locally with
func start
I get only one.Here is the logs:
It looks like the second one is overriding the first one.
I could use
app.http(...)
but it would be far easier if the express like way if doing things was working out of the box.Do you know of some way I could achieve this ?
Related information
Version: 4.0.0-alpha.10
OS: Linux
The text was updated successfully, but these errors were encountered: