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

7 Function Framework binaries should have language-specific aliases #38

Closed
ace-n opened this issue Oct 6, 2020 · 3 comments
Closed
Assignees

Comments

@ace-n
Copy link

ace-n commented Oct 6, 2020

Most of the Functions Frameworks are invoked using either functions-framework or functions_framework terminal commands.

This is fine for environments where only one FF is installed, but environments with multiple FFs (i.e. FFs for multiple languages on the same machine, or multiple FF versions for a single language) make it harder to select specific FFs.

For example:

Node.js directory

$ ls
README.md         all-tests.xml     index.js          node_modules      package-lock.json package.json      test              test.html

Ruby FF (...wait, what?)

$ functions-framework --target=hello_gcs --signature-type=event --port 8089
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin19/rbconfig.rb:229: warning: Insecure world writable dir /Users/anassri/Desktop in PATH, mode 040776
I, [2020-10-05T18:15:25.641369 #83511]  INFO -- : FunctionsFramework v0.5.1 server starting.
I, [2020-10-05T18:15:25.641410 #83511]  INFO -- : FunctionsFramework: Loading functions from "./app.rb"...
Traceback (most recent call last):
	5: from /usr/local/bin/functions-framework:23:in `<main>'
	4: from /usr/local/bin/functions-framework:23:in `load'
	3: from /Library/Ruby/Gems/2.6.0/gems/functions_framework-0.5.1/bin/functions-framework:19:in `<top (required)>'
	2: from /Library/Ruby/Gems/2.6.0/gems/functions_framework-0.5.1/lib/functions_framework/cli.rb:111:in `run'
	1: from /Library/Ruby/Gems/2.6.0/gems/functions_framework-0.5.1/lib/functions_framework/cli.rb:135:in `start_server'
/Library/Ruby/Gems/2.6.0/gems/functions_framework-0.5.1/lib/functions_framework/cli.rb:135:in `load': cannot load such file -- ./app.rb (LoadError)

One possible fix is to add aliases to the existing FF binaries - e.g. functions-framework-<LANGUAGE>, and maybe functions-framework-<LANGUAGE>-<VERSION>. (N.B: I suspect the former is more common than the latter.)


Note: This is an addition - so functions-framework would still work, but may point to an arbitrary FF binary if run on a machine with multiple FFs installed.

@dazuma
Copy link
Member

dazuma commented Oct 6, 2020

The latest version (0.7.0) of the Ruby framework provides both functions-framework-ruby and functions_framework, but deprecates the latter. (i.e. it works, but prints a warning suggesting that users use functions-framework-ruby instead.) Additionally, I just finished updating the Ruby GCF buildpack to use functions-framework-ruby instead of functions-framework. That's the behavior I'd recommend in general.

@grant
Copy link
Contributor

grant commented Oct 8, 2020

@ace-n I think this global functions-framework binaries only happened to very specific languages, i.e. python and ruby. Thus I don't think other languages need specific aliases.

Do you mind filing an issue to not use the generic functions-framework name in language-specific repos as you see the issue? I think that will make more progress.

@ace-n
Copy link
Author

ace-n commented Oct 9, 2020

Done (for Python and Node - since the Node FF can be installed globally via npm install -g)

@ace-n ace-n closed this as completed Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants