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

Cannot set invoker to public for HTTP request function #182

Open
thanhbinh01234 opened this issue Mar 5, 2024 · 3 comments
Open

Cannot set invoker to public for HTTP request function #182

thanhbinh01234 opened this issue Mar 5, 2024 · 3 comments
Labels
waiting for customer response Issue is on hold awaiting more information from OP

Comments

@thanhbinh01234
Copy link

According to the typing of HttpsOptions class, I should be able to set invoker to public or private. But when I tried to deploy a https_fn.on_request function with invoker=True, an error is raised:

[2024-03-06 02:26:16,162] ERROR in app: Exception on /__/functions.yaml [GET]
Traceback (most recent call last):
  File "/Volumes/Cased/Projects/cloud-functions/functions/.venv/lib/python3.11/site-packages/flask/app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/Cased/Projects/cloud-functions/functions/.venv/lib/python3.11/site-packages/flask/app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/Cased/Projects/cloud-functions/functions/.venv/lib/python3.11/site-packages/flask/app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/Cased/Projects/cloud-functions/functions/.venv/lib/python3.11/site-packages/flask/app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/Cased/Projects/cloud-functions/functions/.venv/lib/python3.11/site-packages/firebase_functions/private/serving.py", line 122, in get_functions_yaml
    functions = get_functions()
                ^^^^^^^^^^^^^^^
  File "/Volumes/Cased/Projects/cloud-functions/functions/.venv/lib/python3.11/site-packages/firebase_functions/private/serving.py", line 40, in get_functions
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Volumes/Cased/Projects/cloud-functions/functions/main.py", line 29, in <module>
    @https_fn.on_request(invoker="public", memory=options.MemoryOption.MB_512)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/Cased/Projects/cloud-functions/functions/.venv/lib/python3.11/site-packages/firebase_functions/https_fn.py", line 443, in on_request_inner_decorator
    options._endpoint(func_name=func.__name__),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/Cased/Projects/cloud-functions/functions/.venv/lib/python3.11/site-packages/firebase_functions/options.py", line 1120, in _endpoint
    assert len(
           ^^^^
AssertionError: HttpsOptions: Invalid option for invoker - must be a non-empty list.
@exaby73
Copy link
Contributor

exaby73 commented Mar 11, 2024

Hello @thanhbinh01234. The invoker argument expects a string. From your comment, you are passing True. Could you check or provide a code sample with this fix?

@exaby73 exaby73 added the waiting for customer response Issue is on hold awaiting more information from OP label Mar 11, 2024
@thanhbinh01234
Copy link
Author

I made a mistake in the original comment. I already passed invoker="public" as shown in the exception stack.

@exaby73
Copy link
Contributor

exaby73 commented Mar 18, 2024

Could you provide me with a simple code sample which correctly reproduces this issue? Also, please provide me with your Python version as well as the SDK version you're using. If you are using an older version, do check if this still occurs on the latest version as well. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for customer response Issue is on hold awaiting more information from OP
Projects
None yet
Development

No branches or pull requests

2 participants