firebase / firebase/firebase-tools
Reserved env vars from `.env` should not crash the emulator
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.3k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 84
Description
### [REQUIRED] Environment info
**firebase-tools: 12.0.0**
**Platform: macOS**
### [REQUIRED] Test case
No test case, but the behavior is defined here:
https://github.com/firebase/firebase-tools/blob/56fb8a34201ab903f92178f696bc3b28acfb79bb/src/functions/env.ts#L163-L180
Edit: And I wrote a possible fix in the next comment below this one.
### [REQUIRED] Steps to reproduce
Create a project using the Functions emulator, create a `.env` file with a reserved env var like `FIREBASE_PROJECT_ID` and run `firebase emulators:start`.
### [REQUIRED] Expected behavior
It should log a warning but still be able to run the emulator. Other tools in the project may depend on that env var, it's only disallowed for Firebase, so crashing creates a compatibility issue with basically all other tools that need to access Firebase.
### [REQUIRED] Actual behavior
It crashes the emulator with the following error:
```
Failed to load function definition from source: FirebaseError: Failed to load environment variables from .env.
```
Contributor guide
Assessment
This issue has not been assessed yet.