-
Notifications
You must be signed in to change notification settings - Fork 917
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
New .env-based configuration is not available on functions start in emulator #4361
Comments
While they are working on a change, I discovered the two places where we can insert our required env variables, both for the emulator, and deployments. I dove into the node_modules and changed the code at the locations in the images below. All it does is add the And it works like a charm with nothing more needed. I have not been able to deploy this on functions v2, but I think that's because of some other issue, not this. EDIT: This method is of course not scalable for large teams or applicable in a ci environment (the location of the file I am editing is visible in the left sidebar) |
Other issues that touches on this problem: firebase/firebase-functions#1058 Pasting a response I posted in another issue:
Since this is a common point of confusion, I'm going to try to consolidate our response in a single issue. Arbitrary going to pick the earliest reported issue (firebase/firebase-functions#1044) as our single source of truth. Let's continue our discussion there. |
See firebase/firebase-functions#1084 for our plans around this area. |
I've spent quite a bit of time to move from the old
functions.config()
system to the new.env
-file based config for better developer ergonomics. I'm very, very disappointed that this "feature" was released at all in its current state, since it's a major regression compared tofunctions.config()
.That an environment variable needs to be set in the environment before starting to execute an arbitrary function, that should be obvious. The config values might be available inside
runWith(), .onCall()
etc, but that's not enough. Please fix this or release a new major version, removing support until you can get it right.My case:
Using a config variable to decide which region to deploy functions to fails, since the
.env
-based config is not available on function deploy.Example:
breaks, because the environment variable does not exist... (It's set correctly in the
.env
file)Works well.
It's not OK to release a new feature in this state... Please fix or un-release it asap
(Reported to both here and in firebase/firebase-functions#1065 because I don't know which project is responsible for this change)
The text was updated successfully, but these errors were encountered: