GoogleCloudPlatform/functions-framework-dotnet

Silly idea: make an entry point of "auto" be equivalent to "detect the single function"

jskeet opened this issue · 5 comments

If we could write --entry-point=auto on the gcloud deployment command line, that would simplify things. It would be nicer not to have to do it at all, but I can understand the reasoning for wanting consistency.
But it's up to the Functions Framework how it interprets the value. Could it use a magic value to mean "just find the function for me"?

Must ask internally...

(@amanda-tarafa does this sound too far-fetched to you? I'm aware I haven't had any coffee yet this morning...)

This actually sounds good. I also like the idea of not having to specify anything. --entry-point is already not mandatory I think so that wouldn't be a big deal (although if it's not set then the name of the deployed function should be attempted first as the name of the function type).

Actually, right now, what happens if --entry-point is not specified and there's no env variable? Is there a validation when deploying to Cloud Functions?

Currently if you don't specify --entry-point I think it passes in the name of the function, which isn't useful to us unless it happens to match the fully-qualified type name, which is unlikely as the function name can't include periods.
Will see what others think...

Ah yes, that's what the link I pasted above is about, just wasn't sure who did what. If gcloud is already sending in the name of the function when there's no entry point, then there needs to be a magic value. But gcloud coud just translate that magic value into "don't pass anything as an entry point" and the .NET function framework would already find the one function. I think.

Right, yes. I suspect we don't want to make either gcloud or GCF do that, but instead make it a convention within appropriate functions frameworks, if anything.
(It would be really nice if we could configure gcloud to either pass nothing or pass "auto" if no value was provided and the runtime was dotnet3 or a Java runtime...)

Closing now, as the idea is evolving internally. But we do hope to do it :)