fix(deploy): catch missing prod alias before functions deploy#4
Open
chrishonson wants to merge 1 commit into
Open
fix(deploy): catch missing prod alias before functions deploy#4chrishonson wants to merge 1 commit into
chrishonson wants to merge 1 commit into
Conversation
Firebase CLI v14+ shows the resolved project ID in `firebase use` output whether the project was set via alias (prod) or raw project ID (my-brain-88870), making them indistinguishable. Deploying with the raw project ID silently skips functions/.env.prod, leaving MCP_CLIENT_PROFILES_JSON out of the bundle and causing all /clients/:id/mcp endpoints to 404. - preflight: read the Firebase CLI configstore directly to verify the stored value is the 'prod' alias, not the raw project ID; fail with a clear error and fix command if wrong - DEPLOYMENT.md step 5: warn that --project my-brain-88870 silently skips .env.prod; use --project prod if an explicit flag is needed - DEPLOYMENT.md post-deploy: add step 3 — quick CORS preflight against both client endpoints immediately after deploy to catch missing client profiles before the full smoke test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
firebase useoutput whether the project was set viafirebase use prod(alias, picks upfunctions/.env.prod) orfirebase use my-brain-88870(raw project ID, skipsfunctions/.env.prod). This made the two indistinguishable, so a deploy with the wrong context silently omittedMCP_CLIENT_PROFILES_JSON, causing all/clients/:id/mcpendpoints to return 404.prodalias (not the raw project ID); fails with an actionable error if wrong.--project my-brain-88870silently skips.env.prodand documents--project prodas the safe explicit form.What broke and how it was found
All
/clients/:clientId/mcpendpoints were returning 404 in production. The/healthzand admin/mcpendpoint were healthy. Investigation showedMCP_CLIENT_PROFILES_JSONwas absent from the deployed function — it lives only infunctions/.env.prod, notfunctions/.env. The function had been deployed without theprodalias active (or before.env.prodwas populated), so Firebase never bundled.env.prod.Redeploying with
firebase use prodconfirmed viaLoaded environment variables from .env, .env.prod.in the deploy output. All client endpoints resolved immediately and the admin smoke test passed end-to-end.Test plan
== Firebase project ==section now printsAlias 'prod' confirmed (stored: 'prod' → my-brain-88870)when correctmy-brain-88870in place ofprodproduces the expected error message and non-zero exitfirebase deploylog confirmed.env.prodwas bundled🤖 Generated with Claude Code