This is embarrassing. I must have removed the preview check while refactoring the code after PR feedback. Also improving the logging logic to not log anything if no local dotenv files are found.
Also addresses bug where wrong `FIREBASE_CONFIG` value was set https://github.com/firebase/firebase-tools/issues/3667
Add support for setting up environment variables for functions using dotenv files.
On deploy, Firebase CLI looks for naive dotenv file (`.env`) file or project-specific ones (`.env.<project id>` or `.env.<project alias>`) files, loads environment variables, and injects them on deployed functions. Environment variable set in project-specific dotenv file wins, and you cannot have both `.<project id>` and `<.project alias>` files.
Environment variables are also loaded up on Firebase Emulators. Emulator will look for `.env` and `.env.local` files and ignore project-specific dotenv files.
We are hiding the feature behind `dotenv` preview flag. We want to get a feeling for the development experience from our users before an official launch + documentations.
Also including a small e2e test for env var support. It's meant to run manually by the Firebase team via command `node scripts/test-functions-env.js`.
This isn't a test target that runs as part of CI; it's a useful one to run manually. Also including a small fix in the `functions/prepare.ts` script that I found after fixing the e2e test!
I'm removing the `unknownFilter` test because we now treat any filter as a valid one (Deploy code simply deploys nothing and reports "Deploy Complete"). This is subpar experience, but I've found fix to the issue to be a little more than few lines of change, and I'm not keen on fixing this bug right now.
* Allow larger request body in Auth Emulator. Fixes#3570.
* CHANGLOG
* Apply suggestions from code review
Co-authored-by: Sam <samgho@google.com>
Co-authored-by: Sam <samgho@google.com>
* Don't iterate randomly on auth:export command
* auth:export: Ensure process ends only when all data has been flushed
* Don't use arrow function and comment
* Add CHANGELOG entry
* Add failing test
* Fix gcloud API endpoint to delete a file
* Simplify checking if file has been deleted in test
* Rewrite test to use a nested path and make sure it has been properly created then deleted
Rewrote our logger code in TypeScript.
Because we now need access to types in exported in the logger file, we export logger as a named export instead of assigning exports to logger (an anti-pattern anyway).
This change touches nearly every file because of the named import change. To reduce risk these changes have been made robotically:
```bash
git grep -e "require(.*logger" --name-only | xargs sed -i '' -e 's/var logger = require("\(.*logger\)")/const { logger } = require("\1")/g'
git grep -e "require(.*logger" --name-only | xargs sed -i '' -e 's/const logger = require("\(.*logger\)")/const { logger } = require("\1")/g'
git grep -e "import logger = require(.*logger" --name-only | xargs sed -i '' -e 's/logger = require("\(.*logger\)")/{ logger } from "\1"/g'
git grep -e "import \* as logger" --name-only | xargs sed -i '' -e 's/import \* as logger/import { logger }/g'
```
Other changes like `import { warn } from 'logger'` were touched up manually
Additionally, there were configurations in our logger that had been removed from the winston spec several versions ago (Particularly in our emulator code). TypeScirpt caught these errors and I upgraded to the new version of these APIs.
* move emulator tests into scripts folder
* add run script
* wip
* setup the emulator tests to be compiled and then run
* clean up lines
* upgrade ts-node
* clean up run script
* fix package-lock merge
* Support emulators:export and import for auth.
* Remove projectId from exported data.
* Fix one type-o.
* Export more than one user in tests.
* Handle the case where there are no users.
* Fix one ENOENT error for stat.
* Removing code to handle legacy functions (#2935)
* Disable Node.js 8 deploys for Cloud Functions. (#2934)
* drop testing and support for node 8 (#2620)
* remove/bump node 8s to node 10s
* update some dev dependencies
* update build target to es2017
* formatting
* upgrade mocha
* remove async types
* update check in binary to node 8
* Update package.json
* npm audit: breaking edition (#2941)
* Fix#2880 - generating email link from Admin SDK fails with Auth Emulator (#2933)
* Fix#2880.
* Add changelog entry.
* fixes set-cookie issue (updated #2932) (#2939)
* Fixes#2931 - Support multiple Set-Cookie headers
apiv2.js uses node-fetch under the hood, which will concatenate duplicate headers with ', '. This is invalid for Set-Cookie headers.
The solution is to grab the raw headers (which will be an array) and call `res.setHeader()` with that value.
* add test
* changelog
Co-authored-by: Adam Ahmed <72171617+adam-remotesocial@users.noreply.github.com>
* 8.20.0
* [firebase-release] Removed change log and reset repo after 8.20.0 release
* auto fix audit issues
* force audit update major versions
* remove google-gax
Co-authored-by: Yuchen Shi <yuchenshi@google.com>
Co-authored-by: Adam Ahmed <72171617+adam-remotesocial@users.noreply.github.com>
Co-authored-by: Google Open Source Bot <firebase-oss-bot@google.com>
Co-authored-by: joehan <joehanley@google.com>
Co-authored-by: Michael Bleigh <bleigh@google.com>
Co-authored-by: Yuchen Shi <yuchenshi@google.com>
Co-authored-by: Adam Ahmed <72171617+adam-remotesocial@users.noreply.github.com>
Co-authored-by: Google Open Source Bot <firebase-oss-bot@google.com>
* replace request usage with apiv2
* formatting
* use special handling for non-json response
* fix database get to be more resiliant
* add database tests to client-integration
* changelog
* resolve in the else case too
* Update scripts/client-integration-tests/tests.ts
Co-authored-by: Yuchen Shi <yuchenshi@google.com>
* formatting
Co-authored-by: Yuchen Shi <yuchenshi@google.com>
* Remove preview flag and add release.
* Fix all emulators started log test in integrations.
* Update more logs in the integration tests.
* Update success message for ext:dev.
* Update build.
* Add changelog entry.
Co-authored-by: Yuchen Shi <yuchenshi@google.com>
* rewrite triggers-end-to-end tests in new style
* a little cleanup
* use FBTOOLS_TARGET_PROJECT
* link the CLI before running tests
* fixing up tests
* remove only
* linting cleanup
* save process for more safety
* add better handling for starting with a custom function