Skip to content

Conversation

blidd-google
Copy link
Contributor

@blidd-google blidd-google commented Oct 11, 2023

Some users were running into an error at functions deploy time due to their FIRESTORE_EMULATOR_HOST environment variable being set. The deploy logic should not be reading the emulator host environment variable; this PR fixes the issue by only checking the Firestore origin host URL on deploys.

Fixes #6364.

@blidd-google blidd-google self-assigned this Oct 11, 2023
@blidd-google blidd-google requested a review from joehan October 11, 2023 15:43
@blidd-google blidd-google marked this pull request as ready for review October 11, 2023 15:43
@codecov-commenter
Copy link

codecov-commenter commented Oct 11, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (6c83905) 54.74% compared to head (4b35581) 54.74%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6442   +/-   ##
=======================================
  Coverage   54.74%   54.74%           
=======================================
  Files         346      346           
  Lines       23706    23706           
  Branches     4873     4873           
=======================================
  Hits        12979    12979           
  Misses       9534     9534           
  Partials     1193     1193           
Files Coverage Δ
src/gcp/firestore.ts 32.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@blidd-google blidd-google merged commit 8223c0a into master Oct 11, 2023
joehan added a commit that referenced this pull request Dec 14, 2023
* Missed a few changes from comments (#6015)

* Fixed a bug in the hosting config for emulators. Also fixed an issue
where an empty folder creates an issue loading the side panel.

* Missed some changes

* Update firebase-vscode/webviews/components/EmulatorPanel.tsx

Co-authored-by: joehan <[email protected]>

---------

Co-authored-by: joehan <[email protected]>

* Fix firebase emulators:start crashing (#6005)

* Update proxyResponse method

* Add proper types to proxyResponse function

* Changelog

* Changelog formatting

* Update CHANGELOG.md

* Update firebase-vscode/package-lock.json

---------

Co-authored-by: joehan <[email protected]>

* Revert incorrectly included code (#6022)

* Init flow frameworks cli. (#6010)

* Added init flow commands

* change region name

* Enable frameworkstacks api

* Added code review changes

* Revert unwanted changes

* Revert unwanted changes

* Revert unwanted changes

* change according to project id

* Removed unwanted statements related to projectId

* Frameworks (#6012)

* Initial commit to stacks api

* Added more properties to the Stack and Build object

* Added api calls for framework stacks

* Changed naming

* Changed naming

* Review changes

* Removed and used minimal fields

* Moved frameworks api file

* Switched most uses of track to GA4 (#6016)

* Switched most uses of track to GA4

* Move duration out of params, and improve debug logging slightly

* Release Firestore emulator 1.18.1 (#5942)

* Release Firestore emulator 1.18.1

* Update CHANGELOG.md

Co-authored-by: joehan <[email protected]>

* Formatting changes in CHANGE.md

* Update CHANGELOG.md

---------

Co-authored-by: Jia You <[email protected]>
Co-authored-by: joehan <[email protected]>
Co-authored-by: christhompsongoogle <[email protected]>

* Fix frameworks deploy to preview channel (#6025)

* Inject GOOGLE_CLOUD_QUOTA_PROJECT environment variable during function discovery and emulation (#5985)

When deploying functions that makes use of GCP's usage-based (not resource-based) APIs , such as Vertex AI or ML Vision API, users may see an error like this:


```
// main.py
import vertexai
# Initialize the Vertex AI client
vertexai.init()

$ firebase deploy
Failed to load function definition from source: FirebaseError: Failed to parse build specification

Caused by:
403 Vertex AI API has not been used in project 563584335869 before or it is disabled. 
```

During function discovery, `vertex.init()` makes a call to the Vertex AI with the client credentials associated with Firebase CLI . In the case of usage-based APIs, the call is being made on the Firebase CLI project, not the users project, resulting in the error message like `been used in project 563584335869 before or it is disabled.` (project `563584335869` is the Firebase CLI GCP project).

Similar issue happens when running the function on the emulator.

To workaround the issue, we have to properly override the client project associated with the Vertex AI API call. There are few ways for doing this, and here we choose to leverage `GOOGLE_CLOUD_QUOTA_PROJECT` environment variable to correctly override the quota project to be the user project associated with the Firebase CLI session.

* Reimplement Storage emulator /internal/setRules (#6014)

* stash

* commit

* commit

* lint

* fix tests

* const

* Adding JSON schema for extension yaml (#5984)

* Starting on extension.yaml json schema

* finsh extension.yaml schema

* adding events

* add billingrequired

* Adding schemas to vscode plugin too

* reverting new format for firebase-config.json

* Set up vscode plugin test flow (#6024)

* Print functions discovery to stdout/error (#5931)

* Print functions discovery to stdout/error

* More tweaking

* lint fixes

* Use logger instead of console to work with --json

---------

Co-authored-by: Daniel Lee <[email protected]>

* Bump firebase-frameworks version in constants.ts (#6038)

Fixes compatibility with latest Next.js

* Revert emulators changes (#6030)

* Fix table in CONTRIBUTING.md (#6029)

Multi-line table syntax is not supported in GitHub Markdown.

* Implement module to link stack to GitHub repository (#5793)

* add internal testing cmd for connecting gh to cloud build repos

* use regex to extract repo slug

* add comments

* add unit tests

* fix tests

* refactoring & allow changing gh app access settings

* refactor & update unit tests

* add comments & change internaltesting name

* rename to composer

* Imporved extensions metrics (#6037)

* Switched most uses of track to GA4

* Move duration out of params, and improve debug logging slightly

* Improved metrics for extensions

* formats

* 12.4.1

* [firebase-release] Removed change log and reset repo after 12.4.1 release

* Refactored ext:install to use the latest extension metadata. (#5997)

* Added cascading of latest approved version to latest version when installing.

* Changed output of extension version info.

* Formatting, added more metadata, and cleaned up TODOs.

* Formatting and extra notices.

* Added even more metadata.

* Formatting.

* Fixing tests.

* Added display of extension resources.

* Added link to Extensions Hub.

* Added displaying of events.

* Formatting.

* Formatting.

* Version bug.

* Added displaying of secrets and task queues.

* Added displaying of external services.

* Fixed resolveVersion() + tests.

* Added tests for displayExtensionInfo().

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: joehan <[email protected]>

* Better messaging and parameterizing.

* Update displayExtensionInfo.ts

* Update displayExtensionInfo.spec.ts

* Update CHANGELOG.md

---------

Co-authored-by: joehan <[email protected]>

* Discovery: Added node runtime. (#5993)

* Added runtime command discovery

* Resolved comments

* Added error case to analyse codebase method

* Updated install command

* Reorganized tests and removed unwated promise.resolve stmt

* Added review changes on install command and node version string array

* Changes to node.ts to include additional condions on run script

* Added code comments to types

* Added undefied to return if no cmd

* Added undefied to return if no cmd

* Increased create extensions instance timeout to 1h to match the backend (#5969)

* Normalized extension root path before usage in ext:dev:upload. (#6054)

* Normalized extension root path before usage.

* Update CHANGELOG.md

* Update publisherApi.ts

* Update extensionsHelper.ts

* Update CHANGELOG.md

* Replaced join() with normalize() and fixed regex.

* Update extensionsHelper.ts

* Update extensionsHelper.ts

* Migrates functions metrics to GA4  (#6053)

* track functions metrics with ga4

* remove old track() calls

* Fix incorrect warnings when emulating extensions with httpsTriggers (#6055)

* Only record metrics if user confirms ext:install (#6047)

* Only record metrics if user confirms ext:install

* format

* Added descriptive error when repo is private or not found during ext:dev:upload. (#6052)

* Added more descriptive error message when repo is private (or not found).

* Formatting.

* Formatting.

* Update CHANGELOG.md

---------

Co-authored-by: joehan <[email protected]>

* Allow $schema property in firebase.json (#6051)

* Allow $schema property in firebase.json

* Add $schema property via firebaseConfig.ts

---------

Co-authored-by: joehan <[email protected]>

* Run lifecycle hooks for specific functions (#6023)

* run lifecycle hooks for individual functions

* 12.4.2

* [firebase-release] Removed change log and reset repo after 12.4.2 release

* Integrate discovery with composer (#6042)

* Added runtime command discovery

* Resolved comments

* Added error case to analyse codebase method

* Updated install command

* Reorganized tests and removed unwated promise.resolve stmt

* Added review changes on install command and node version string array

* Changes to node.ts to include additional condions on run script

* Added code comments to types

* Integrate discovery with composer

* Minor modification

* Minor changes

* Minor changes

* Resolved code commits

* Added undefied to return if no cmd

* Added undefied to return if no cmd

* Added frameworkhook interface

* code comments

* format error msg

* format error msg

* format error msg

* format error msg

* Code comments

* Fixed imports and compose command

* Fix bugs.

* Update base image for node runtime.

* bug fix

* bug fix

* Remove hooks

---------

Co-authored-by: Daniel Young Lee <[email protected]>

* VSCode plugin: Workarounds for functions code + Monospace settings (#6056)

* Git to cloud build (#6044)

* Initial commit integrate init with api

* Revert "Initial commit integrate init with api"

This reverts commit 14751512d769d675e9d9fc624c34dfe41f461f0e.

* removed internaltesting:frameworks:int command

* integrate git repo with cloudBuildRepo

* Added changes to create stack

* Added changes to create stack

* Added code to omit output fields in Stack

* Added poller operation

* Added poller operation

* Added code to integrate init flow to link Git repo and to call frameworks api

* Minor changes

* minor changes

* deleted output file

* Rearranged files

* Fix imports

* Reorganized files

* minor changes

* Frameworks: Call "next build" from command line instead of import (#6066)

* Add support for running package manager install command. (#6064)

* Release Firebase Emulator UI v 1.11.7 (#6079)

* Release Firebase Emulator Ui v 1.11.7

* Update commit

---------

Co-authored-by: joehan <[email protected]>

* Update firebase open links (#6073)

* Update firebase open links

* adding changelog

---------

Co-authored-by: joehan <[email protected]>

* 12.4.3

* [firebase-release] Removed change log and reset repo after 12.4.3 release

* VSCode plugin: Handle service accounts better (#6078)

* Disables KeepAlive timeout when debugger is attached to the functions emulator (#6069)

Node.js 19 introduced a change that sets `keepAlive` to true by default, with a default keep-alive duration of 5 seconds. This change broke our functions emulator behavior when a debugger was attached, as the Node.js HTTP server would consider the connection to be idle when a breakpoint was hit and disconnect after 5 seconds. This PR disables HTTP Keep-Alive and sets the socket timeout to 0 so that breakpoints won't cause the connection to timeout.

Fixes https://github.com/firebase/firebase-tools/issues/5991.

* Make firebase:database:list to always use the RTDB management API (#6063)

* remove rtdbmanagement experiment

* rm firedata api

* m

* avoid breaking changes

* m

* doc

* Update database-instances-list.ts

* Update CHANGELOG.md

* Clarifying what the CLI does with dynamic content on next.js (per customer feedback). (#6093)

* Rewrite `src/localFunction.js` in TypeScript. (#6092)

`src/localFunction.js` is used to power the `functions:shell` command. We need to make substantial changes to it to properly support 2nd Gen functions (https://github.com/firebase/firebase-tools/issues/6089). Rewriting the source in modern TypeScript as a prep.

* VSCode plugin: Add UX improvements (#6091)

* Round of dependabot updates (#6116)

* Bump tough-cookie in /scripts/webframeworks-deploy-tests/angular (#6097)

Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](https://github.com/salesforce/tough-cookie/compare/v4.1.2...v4.1.3)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semver and npm in /standalone (#6107)

Bumps [semver](https://github.com/npm/node-semver) to 7.5.4 and updates ancestor dependency [npm](https://github.com/npm/cli). These dependencies need to be updated together.


Updates `semver` from 7.5.1 to 7.5.4
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.5.1...v7.5.4)

Updates `npm` from 6.14.18 to 9.8.0
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md)
- [Commits](https://github.com/npm/cli/compare/v6.14.18...v9.8.0)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
- dependency-name: npm
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semver from 7.3.8 to 7.5.4 in /scripts/emulator-tests/functions (#6106)

Bumps [semver](https://github.com/npm/node-semver) from 7.3.8 to 7.5.4.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.3.8...v7.5.4)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <