-
Notifications
You must be signed in to change notification settings - Fork 28
Error in secrets #141
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
Comments
Yeah, so the method using Is it just missing from the docs that only e.g. |
Searching through the codebase I can't find anywhere where env vars are set. Only got. So it appears that this feature is silently completely unsupported, though the docs claim it is. Is that the case? I searched for the following:
If it's supported, it's implemented elsewhere - I wonder if someone might point me to the other codebase where the environment variables are shown to be injected? |
I faced a similar issue, and I think it's caused by the outdated documentation here. https://firebase.google.com/docs/functions/config-env?gen=2nd#secret_parameters Just removing the parentheses in the end solves the issue from firebase_functions import https_fn
from firebase_functions.params import SecretParam
DISCORD_API_KEY = SecretParam('DISCORD_API_KEY');
@https_fn.on_request(secrets=[DISCORD_API_KEY])
def post_to_discord(req):
api_key = DISCORD_API_KEY.value() --> remove this parentheses |
There appear to be two redundant methods for accessing secrets in firebase functions, according to https://firebase.google.com/docs/functions/config-env?gen=2nd
From the docs:
and that
SECRET_NAME
is available once you dofirebase functions:secrets:set SECRET_NAME
.I've set a secret and confirmed it exists (tagged with "firebase-managed" in the console, available via
firebase functions:secrets:access
).Yet, when I use
os.getenv('SECRET_NAME')
from within afirestore_fn
that has the keyword argumentsecrets=['SECRET_NAME'
, the environment variable remains unset (i.e. the getenv returns None).Beyond the confusion of having two apparently redundant methods for providing secret access in functions, the second of the two does not appear to work. Please let me know if I'm missing something.
Finally, the first method (using
params.SecretParam
) hasn't worked yet for me either. I wonder if the Firebase team or a more advanced user can advise?The text was updated successfully, but these errors were encountered: