Skip to content

feat(functions): Add more details to FunctionsError#9942

Open
hsubox76 wants to merge 4 commits into
mainfrom
ch-functions-errors
Open

feat(functions): Add more details to FunctionsError#9942
hsubox76 wants to merge 4 commits into
mainfrom
ch-functions-errors

Conversation

@hsubox76
Copy link
Copy Markdown
Contributor

@hsubox76 hsubox76 commented May 11, 2026

Functions errors historically have not have a lot of detail which makes debugging difficult. We can't provide much more detail when it comes to network errors and native API "fetch errors", since they don't provide us with much information, but I am adding what we can.

  1. Add the http status code into the message. I think a lot of the more mysterious failures will be 0, meaning a network or fetch error, which we don't have any further information on, so this might not be that helpful.
  2. Add a url string in the customData field (customData is standard in all FirebaseError objects). This may help debug a nonexistent function name or region, for example.

Fixes #9807

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 11, 2026

🦋 Changeset detected

Latest commit: 0131a85

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/functions Minor
@firebase/functions-compat Minor
firebase Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@hsubox76 hsubox76 mentioned this pull request May 11, 2026
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 FunctionsError by including the HTTP status code in the error message and adding url and details fields to customData. It updates the error handling logic in _errorForResponse and ensures the request URL is propagated through the error reporting chain. Feedback was provided regarding the FunctionsError constructor, specifically noting that direct assignment to customData might violate readonly constraints and that the current falsy check for details could skip valid values like 0 or false. It is recommended to pass the customData object directly to the super call instead.

Comment thread packages/functions/src/error.ts Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

Changeset File Check ✅

  • No modified packages are missing from the changeset file.
  • No changeset formatting errors detected.

@hsubox76 hsubox76 marked this pull request as ready for review May 13, 2026 18:05
@hsubox76 hsubox76 requested review from a team as code owners May 13, 2026 18:05
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.

functions/internal

2 participants