Skip to content

Add validation to check if backendId exists when --only flag is used#10170

Merged
joehan merged 5 commits intomainfrom
aalej_fix-10161
Mar 31, 2026
Merged

Add validation to check if backendId exists when --only flag is used#10170
joehan merged 5 commits intomainfrom
aalej_fix-10161

Conversation

@aalej
Copy link
Copy Markdown
Contributor

@aalej aalej commented Mar 25, 2026

Description

Fixes #10161

Scenarios Tested

With firebase.json config

{
  "apphosting": [
    {
      "backendId": "web-app",
      "rootDir": "./next-app",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log",
        "functions"
      ]
    },
    {
      "backendId": "my-other-web-app",
      "rootDir": "./next-app",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log",
        "functions"
      ]
    }
  ]
}

Running firebase deploy --project PROJECT_ID --only apphosting:non-existent-backend outputs

$ firebase deploy --project PROJECT_ID --only apphosting:non-existent-backend

=== Deploying to 'PROJECT_ID'...

i  deploying apphosting

Error: App Hosting backend IDs non-existent-backend not detected in firebase.json

Having trouble? Try firebase [command] --help

Running $ firebase deploy --project PROJECT_ID --only apphosting:web-app

$ firebase deploy --project PROJECT_ID --only apphosting:web-app

=== Deploying to 'PROJECT_ID'...

i  deploying apphosting
i  apphosting: Found backend(s) web-app
i  apphosting: Zipped source for backend web-app
i  apphosting: Uploading source for backend web-app...
i  apphosting: Uploaded at gs://firebaseapphosting-sources-[REDACTED]-.zip
i  apphosting: You may also track the rollout(s) at:
        https://console.firebase.google.com/project/PROJECT_ID/apphosting
⠴ Starting rollout(s) for backend(s) web-app; this may take a few minutes. It's safe to exit now.
✔  apphosting: Rollout for backend web-app complete!
✔  apphosting: Your backend is now deployed at:

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/PROJECT_ID/overview

Sample Commands

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the firebase deploy command by adding crucial validation for App Hosting backend IDs. It ensures that when users specify particular backend IDs using the --only flag, these IDs are correctly defined within their firebase.json file. This prevents deployments from proceeding with invalid or non-existent configurations, thereby improving the robustness and user experience of the deployment process.

Highlights

  • Validation for App Hosting Backend IDs: Implemented validation to ensure that all apphosting backend IDs specified with the --only flag during deployment exist in the firebase.json configuration.
  • Improved Error Handling: Introduced a FirebaseError that is thrown if any of the backend IDs provided via the --only flag are not found in firebase.json, providing clear feedback to the user.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the getBackendConfigs function by adding a validation step to ensure all requested backend IDs are present in firebase.json. If any IDs are missing, a FirebaseError is thrown. A review comment suggests explicitly setting the exit: 1 property for the FirebaseError to align with the style guide's recommendation for precondition violations.

@joehan joehan self-requested a review March 31, 2026 17:43
@joehan joehan enabled auto-merge (squash) March 31, 2026 18:27
@joehan joehan merged commit 0e1c259 into main Mar 31, 2026
47 checks passed
@joehan joehan deleted the aalej_fix-10161 branch March 31, 2026 18:38
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.

App Hosting: firebase deploy --only apphosting:<backendId> exits successfully without deploying when no matching backendId exists in firebase.json

3 participants