-
Notifications
You must be signed in to change notification settings - Fork 447
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
Allow discovery of functions in nested directories #5373
Comments
This would be amazing. Without it, multi-function apps quickly become disorganized. |
Not supporting this is frankly ridiculous. |
It is probably straightforward to make the runtime capable of discovering functions in nested directories. However there would be a larger work item to make sure that tooling knows how to interact with nested functions correctly. For example, I suspect the editor in the Azure portal would not handle this correctly today. More tooling analysis is required before we consider making this runtime change. |
Another approach here is to leverage the build process to generate the appropriate output but still support the file structure and code management to follow the model above. |
This isn't ideal for scripting languages like JavaScript that don't necessarily require a build process, but doesn't mean we can't include one! |
I don't know if this behavior is specific to class library type project. haven't tested it on Azure or even doing request to those endpoints locally |
I completely agree that this is a necessary feature to be implemented, for http functions this seems like an obvious choice. The only workaround I've tried to kind of mimic this is adding a prefix to the function directories and changing the route in the A folder structure something like this:
with a {
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": ["get"],
"route": "account/get-all"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
]
} This does not fix the problem and I still completely agree that this should be a feature, however this should at least order your functions correctly which has ended up being my biggest issue. |
This feature is definitely needed. As my application grow I struggle more and more organizing my folders.. |
We’ve been doing some active prototyping on a few options here - no ETA, but is definitely on the roadmap and a capability we recognize is needed. Potentially later this calendar year. It’s also worth noting it’s mainly the function.json that needs to be in a specific spot. It can reference .js modules from elsewhere using the “scriptFile” property |
@jeffhollan Perhaps the host.json |
For TypeScript projects, Decorators could be a good option. That would make it more similar to .NET |
As @jeffhollan mentioned, we're investigating newer programming models. There's some foundational work on the core runtime and language workers that are needed before we can enable these scenarios. Depending on other priorities, we're hoping to make some progress in the second half of this year. |
Any update on progress with this @anthonychu @jeffhollan? |
I could use this feature also to help organize multi-function projects, any word @anthonychu ? |
agree. |
@cr1tterp0wer Based on what standards and good practices? Most serverless tools I've used have allowed for nested directories based on endpoint type. |
|
@anthonychu, do you have any updates ? It's already 2022... |
@anthonychu do you have any updates? |
The teams are working on new programming models for Python and Node.js. @ejizba @vrdmr @stefanushinardi |
Here's the issue to track the new Node.js programming model: Azure/azure-functions-nodejs-worker#480 We've made some progress on prototypes, and we'd welcome any feedback y'all have |
@ejizba @anthonychu do we have any ETA of when this feature will be available? Or how far off is this newer programming model from completion? I appreciate that this is being worked on, however this issue was opened almost 3 and a half years ago. |
Hi, we recently created a roadmap that you can use to track dates for Node.js features. We will try to keep it as up to date as possible. See here: https://github.com/Azure/azure-functions-nodejs-worker/wiki/Roadmap A few other notes:
|
Thank-you for the update @ejizba, and the roadmap is helpful to get an idea of estimated timelines 🙏 |
@ejizba I see the tracker for Node, but I'm not seeing a way to get updates around the Python effort. Are there any updates specific to Python? |
The Python team just created a roadmap, here it is: https://github.com/Azure/azure-functions-python-worker/wiki/Roadmap In addition, they actually already announced public preview of their new programming model. Here are docs for trying it out: https://github.com/Azure/azure-functions-python-worker/wiki/V2-Programming-Model-for-Azure-Functions-using-Python |
We just announced public preview of the new Node.js programming model! 🎉 Try it out and let us know what you think: This GitHub issue was one of the main motivators for this effort, so thank you for all the upvotes and comments (even if it took a lot longer than everyone wanted). While the new model has many benefits, you might notice "Flexible folder structure" is listed first in the blog post. |
The Python team GA'ed their new programming model in May and for Node.js we just GA'ed the new programming model today 🥳 I think that's enough to close this issue. Other languages are also working on new programming models, although I don't know when they would happen. I would suggest tracking further progress in the language-specific GitHub repo, for example this is PowerShell's repo: https://github.com/Azure/azure-functions-powershell-worker/issues |
Wow where did 5 years go by so fast? Thanks! |
As far as I'm aware, the
func host start
command currently requires a directory structure in which thefunction.json
files reside in directories that are siblings to thehost.json
- or the function project root. So, currently a directory structure something like ..I'm familiar with the two config options for specifying script location and entry point, but those two still require that the function host can discover the
function.json
.Would it be possible to add a config option to allow the function host to discover functions that are nested deeper than one directory? Perhaps something that might let me structure a directory like ...
... and so on.
With this, in combination with the already existing options to specify script location, you could pretty much structure a more complex functions app in any way you want. It'd work great with multi-function typescript projects, where the compiled output goes into a
lib
folder, as well.The text was updated successfully, but these errors were encountered: