Skip to content

Surface underlying api errors - #11133

Open
falahat wants to merge 11 commits into
firebase:mainfrom
falahat:surface-underlying-api-errors
Open

falahat wants to merge 11 commits into
firebase:mainfrom
falahat:surface-underlying-api-errors

Conversation

@falahat

@falahat falahat commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

When the user tries to create a secret, they might get a billing error. This change just surfaces that error and its message more clearly.

Scenarios Tested

Sample Commands

firebase apphosting:secrets:set some-secret-key --project  ...

Error: Unexpected error loading secret: Request to https://secretmanager.googleapis.com/v1/projects/.../secrets/some-secret-key had HTTP Error: 403, This API method requires billing to be enabled. Please enable billing on project #... by visiting https://console.developers.google.com/billing/enable?project=... then retry. If you enabled billing for this project recently, wait a few minutes for the action to propagate to our systems and retry.

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

Copy link
Copy Markdown
Contributor

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 improves error handling by surfacing underlying API errors instead of masking them with generic messages. Specifically, in apiv2.ts, non-JSON error responses are handled gracefully by retaining the raw payload when the status is 400 or above. In src/apphosting/secrets/index.ts, unexpected errors during secret loading now include the original error message. The reviewer suggested propagating the original HTTP status code when wrapping the unexpected error in FirebaseError within upsertSecret to prevent it from defaulting to 500.

Comment thread src/apphosting/secrets/index.ts Outdated
@codecov-commenter

codecov-commenter commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@13de3bc). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11133   +/-   ##
=======================================
  Coverage        ?   60.88%           
=======================================
  Files           ?      651           
  Lines           ?    43808           
  Branches        ?     9012           
=======================================
  Hits            ?    26674           
  Misses          ?    14894           
  Partials        ?     2240           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

4 participants