113 Commits

Author SHA1 Message Date
Daniel Lee
592a4ee6cb Fix Firebase Function deploy bugs. (#3668)
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
2021-08-12 11:23:12 -07:00
Bryan Kendall
574660a2e5 fix track import in functions release (#3665)
* fix track import in functions release

* upgrade firebase-functions libraries

* Fix require issue with new firebase-functions version.

Co-authored-by: Michael Bleigh <bleigh@google.com>
2021-08-11 17:57:24 -07:00
Daniel Lee
d9aaaec1f3 Deploy environment variables in dotenv files for functions (#3645)
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`.
2021-08-11 13:31:18 -07:00
dependabot[bot]
95e128ac44 Bump path-parse from 1.0.6 to 1.0.7 in /scripts/firepit-builder (#3662)
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bryan Kendall <bkend@google.com>
2021-08-11 11:48:39 -07:00
Daniel Lee
70f8c9f59c Fix broken functions deploy e2e test. (#3635)
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.
2021-08-05 11:04:43 -07:00
Yuchen Shi
f13b644c99 Allow larger request body in Auth Emulator. Fixes #3570. (#3577)
* 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>
2021-07-15 16:39:28 -07:00
Abe Haskins
2cc2293528 Fixes #3406 (#3410)
Co-authored-by: joehan <joehanley@google.com>
2021-05-26 14:03:18 -07:00
Abe Haskins
a0128387da Storage Emulator "Fast-Follow" Bug Fixes (#3403) 2021-05-26 12:20:35 -05:00
Sam Stern
769cb0fd21 Actually run storage integration tests (#3320) 2021-05-24 12:13:23 -04:00
Kiana McNellis
92e1809ae2 Enable a function to be emulated in multiple regions (#3364) 2021-05-19 08:36:19 -04:00
Aravind V. Nair
ba41c67bfe Fix CVE-2020-7774 for y18n (#3372)
Bump y18n from 4.0.0 to 4.0.3 in /scripts/firepit-builder
2021-05-18 15:51:17 -04:00
Abe Haskins
ecb04c16c8 Storage Emulator Fixes / Improvements (#3370) 2021-05-17 16:48:52 -05:00
Johan Preynat
a4af4b1500 Fix storage emulator for file.delete() API (#3375)
* 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
2021-05-17 12:10:14 -07:00
Johan Preynat
f7bfba2ded Fix storage emulator for file.download() API (#3374) 2021-05-17 12:57:29 -05:00
Sam Stern
1e4d2e6e7a Storage emulator import/export (#3317) 2021-05-04 11:43:24 -04:00
Abe Haskins
93abee929d Implements Storage Emulator (#3230)
* Adds Storage Emulator

* npm run format

* Attempt to fix failing runtime test
2021-03-25 13:15:21 -07:00
Thomas Bouldin
1633f4fccb Upgrade logger to TypeScript (#3138)
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.
2021-03-12 14:47:50 -08:00
Bryan Kendall
3ade0fc23a increase wait time before checking live sites in Hosting test (#3205) 2021-03-11 12:49:49 -08:00
ssbushi
f7d5ef7f00 Auth emulator modify secuirity (#3044)
* Removed security requirements for Auth Emulator APIs

* Undo changes to package.json
2021-01-15 10:41:06 -08:00
Bryan Kendall
daa9fd58dc move emulator suite tests into scripts folder (#3035)
* 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
2021-01-15 09:48:05 -08:00
Bryan Kendall
933ef1b25b remove unused deps, update license to match repo (#3039)
* remove unused deps, update licence to match repo

* need firebase-admin since it's a peer dependency
2021-01-14 13:27:54 -08:00
Bryan Kendall
2dc7216a49 upgrade prettier (#3010)
* upgrade prettier

* prettier formatting
2021-01-08 16:01:31 -08:00
Bryan Kendall
bc35efaa64 upgrade eslint dependencies (#3009) 2021-01-08 15:48:48 -08:00
Yuchen Shi
9e175eb7fa Support emulators:export and import for auth. (#2955)
* 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.
2020-12-17 18:12:02 -08:00
Sam Stern
5981ff02c5 Remove node version checks in tests (#2952)
* Remove node version checks in tests

* Lint

* Review fix
2020-12-17 10:58:53 -08:00
Bryan Kendall
8c22040af4 v9.0.0! (#2942)
* 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>
2020-12-15 15:30:36 -08:00
Bryan Kendall
f557ac8d10 add sleep before firepit build (#2888) 2020-12-02 15:03:24 -08:00
Yuchen Shi
451b1d6338 Change ESLint no-invalid-this to error. (#2882)
* Change ESLint no-invalid-this to error.

* Fix more linter errors (from upgrading ts-eslint).

* Fix eslintrc options grouping.
2020-12-01 15:05:07 -08:00
Bryan Kendall
f88920fb5d remove request module from database helpers (#2828)
* 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>
2020-11-17 15:44:50 -08:00
Bryan Kendall
cd6e7ef80e integration framework: request -> node-fetch (#2787)
* request -> fetch

* statusCode -> status

* await on the response data
2020-11-11 12:46:10 -08:00
Bryan Kendall
f6ffc3f3e4 [cleanup] remove unexpected awaits (#2806)
* remove unexpected awaits

* wrap logic in promise
2020-11-11 12:22:16 -08:00
Bryan Kendall
03050eac3e mock auth globally for tests (#2805)
* mock auth globally for tests

* remove unused method

* remove unused dep

* fix imports in integration scripts
2020-11-11 11:05:52 -08:00
Sam Stern
2f53d4bd0d Automatically call useEmulator in Hosting emulator (#2753) 2020-11-03 14:33:14 -05:00
Sam Stern
77a02b0159 Add e2e tests for the Auth emulator (#2754) 2020-10-28 13:44:21 -04:00
Bryan Kendall
4fe7bcdd76 fix use of normalizedHostingConfigs when it is called repeatedly (#2748)
* fix normalizedHostingConfig across multiple calls

* add tests for deploying to a hosting target and deploying a hosting channel to a target
2020-10-27 11:09:03 -07:00
Sam Stern
0cf70a0984 Fix default arguments and option when using as a module (#2723) 2020-10-21 12:31:36 -04:00
joehan
8165ccdceb Update function deploys to default to node 12 (#2713)
* Update function deploys to default to node 12

* Update src/deploy/functions/checkRuntimeDependencies.ts

Co-authored-by: Michael Bleigh <bleigh@google.com>

* Linter

* Dont ensure CloudBuild if deploying node 8

* adds jsdoc

* Add Changelog entry

Co-authored-by: Michael Bleigh <bleigh@google.com>
2020-10-15 15:57:33 -07:00
Sam Stern
226ea560fb Always export any imported namespaces (#2648) 2020-10-08 05:32:51 -04:00
Bryan Kendall
e9ff33f544 npm audit fixes (#2630)
* audit fixes

* audit fixes
2020-09-22 13:30:48 -07:00
Yuchen Shi
41885e0bd3 Implement Firebase Authentication Emulator. (#2631) 2020-09-22 12:58:42 -07:00
Daniel Lee
56c7c845f4 Set publish cloud build timeout to 20 minutes (#2578) 2020-08-27 05:54:07 -04:00
Sam Stern
9f97c402f0 Fix firebase-debug.log competition (#2494) 2020-07-27 14:12:34 -04:00
Sam Stern
ba06f6dc34 Add import/export support to Realtime Database (#2429) 2020-07-06 23:24:32 -04:00
Tadashi Nemoto
adfb601d41 Set template default node.js version to 10 because support of node.js8 will end (#2407) 2020-06-29 08:14:41 -04:00
Sam Stern
de523a9cdf Unlock the Emulator UI (#2226)
* 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>
2020-05-21 10:21:05 -07:00
Abe Haskins
66228c03db Improves "emulators:start" logs (#2219) 2020-05-14 16:33:49 -05:00
Bryan Kendall
e5c1bdbef3 extensions functional test update (#2181)
* use shared testing framework for tests

* remove AndWait function

* link global module and run test file
2020-04-27 14:11:16 -07:00
Bryan Kendall
fd199e3f90 revamp triggers end-to-end functional test (#2178)
* 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
2020-04-27 11:13:02 -07:00
Bryan Kendall
a6ee068e51 update hosting integration test structure (#2177) 2020-04-27 09:34:06 -07:00
Bryan Kendall
9a92742826 remove package-lock file (#2170)
* remove package-lock file

* Create .gitignore
2020-04-24 12:12:39 -07:00