Skip to content

Conversation

@aalej
Copy link
Contributor

@aalej aalej commented Jul 24, 2024

Description

Fixes #7190

Scenarios Tested

Using the test case provided in #7190

  1. Set GOOGLE_APPLICATION_CREDENTIALS to a service account key that does not have access to the project used in the next command
  2. Try to run firebase deploy --project invalid-project-name-2358923 --only hosting --non-interactive
$ firebase logout
No need to logout, not logged in
$ echo $GOOGLE_APPLICATION_CREDENTIALS
./service-account-invalid.json
$ firebase deploy --project invalid-project-name-2358923 --only hosting --non-interactive

Error: Failed to get Firebase project invalid-project-name-2358923. Please make sure the project exists and your account has permission to access it.

Using an logged in account deploying to a project it has no access to

$ firebase login
Already logged in as EMAIL
Using Google Analytics in DEBUG mode. Emulators (+ UI) events will be shown in GA Debug View only.
$ firebase deploy --project invalid-project-name-2358923 --only hosting --non-interactive
Using Google Analytics in DEBUG mode. Emulators (+ UI) events will be shown in GA Debug View only.

Error: Failed to get Firebase project invalid-project-name-2358923. Please make sure the project exists and your account has permission to access it.

Note: Using a valid service-account and project

$ firebase logout
No need to logout, not logged in
$ echo $GOOGLE_APPLICATION_CREDENTIALS
./service-account-valid.json
$ firebase deploy --project PROJECT_ID --only hosting --non-interactive

=== Deploying to 'PROJECT_ID'...

i  deploying hosting
i  hosting[PROJECT_ID]: beginning deploy...
i  hosting[PROJECT_ID]: found 2 files in public
i  hosting: uploading new files [0/1] (0%)
i  hosting: upload complete
✔  hosting[PROJECT_ID]: file upload complete
i  hosting[PROJECT_ID]: finalizing version...
✔  hosting[PROJECT_ID]: version finalized
i  hosting[PROJECT_ID]: releasing new version...
✔  hosting[PROJECT_ID]: release complete

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/PROJECT_ID/overview
Hosting URL: https://PROJECT_ID.web.app

Sample Commands

@joehan joehan self-requested a review July 24, 2024 21:32
@aalej
Copy link
Contributor Author

aalej commented Jul 26, 2024

Oops, didn’t realize I put the wrong log messages in the initial comment. Updated it from

Error: Assertion failed: resolving hosting target of a site with no site name or target name. This should have caused an error earlier

to

Error: Failed to get Firebase project invalid-project-name-2358923. Please make sure the project exists and your account has permission to access it.

@joehan joehan requested a review from kmcnellis July 26, 2024 21:59
@joehan joehan enabled auto-merge (squash) July 30, 2024 18:05
@joehan joehan merged commit 6004e0d into master Jul 30, 2024
@aalej aalej deleted the aalej-7190 branch March 25, 2025 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running firebase deploy with service account and missing permission errors with "Assertion failed"

4 participants