-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I have been working with Python Cloud Functions for Firebase for a few weeks now and we are having an issue when it comes to float params with FloatParam.
Basic code to reproduce:
# .env
MY_FLOAT=0.0# main.py
from firebase_functions.params import FloatParam
import firebase_admin
firebase_admin.initialize_app()
my_float = FloatParam("MY_FLOAT").valueFrom that setup, I have 2 issues:
- The first one is that params types (string, int, boolean, float ...) cannot be read outside of a function implementation (i.e functions annotated with
@tasks_fn.on_task_dispatchedor@https_fn.on_callfor example) - Second one is, whenever I move the reading part inside of Callable/Queue function implementation, my env var value got wrapped into an array (only for float params), then I got the following error when the CF tries to start up in Cloud Run:
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/firebase_functions/params.py", line 353, in value
return float(_os.environ[self.name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: '["0.0"]'
NB: That "array wrapping" behaviour for floats is not happening locally with emulators.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working