Skip to content

fix(dataconnect): fix deserialization of emulator gRPC error codes into detailed errors#3180

Merged
stephenarosaj merged 5 commits into
mainfrom
rosa/emulator-error-fix
Jun 17, 2026
Merged

fix(dataconnect): fix deserialization of emulator gRPC error codes into detailed errors#3180
stephenarosaj merged 5 commits into
mainfrom
rosa/emulator-error-fix

Conversation

@stephenarosaj

@stephenarosaj stephenarosaj commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Description

✨ Added gRPC status code mapping to ensure error responses from the local Data Connect emulator are correctly deserialized. Before these changes, when using the emulator, errors are improperly deserialized into DataConnectErrors with unknown-error instead of ones with detailed code and message fields.

Verified by running the integration tests against the emulator (and production) before and after the changes. What was broken is now fixed!

Changes

  • Added GRPC_STATUS_CODE_TO_STRING mapping dictionary
  • Updated toFirebaseError to handle root-level gRPC error responses
  • Added FDC emulator debug log files to .gitignore

Testing

  • Currently, integration tests fail against the emulator. Now they pass.
  • Added unit test verifying deserialization of transcoded gRPC numeric error codes

@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 adds support for handling gRPC-to-HTTP transcoded error responses in the Data Connect API client by mapping numeric gRPC status codes to their string equivalents. It also updates .gitignore to exclude local debug logs and adds a unit test to verify the new error-handling behavior. A critical issue was identified in the error parsing logic where a null error property in the response could lead to a TypeError and crash the error-handling flow; a code suggestion was provided to safely handle this scenario.

Comment thread src/data-connect/data-connect-api-client-internal.ts Outdated
@dconeybe

Copy link
Copy Markdown

ultranit: looks like there may be some mismatched backticks in the PR description (see attached screenshot)

image

@jonathanedey jonathanedey 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.

LGTM, Thanks!

@jonathanedey jonathanedey added the release:stage Stage a release candidate label Jun 17, 2026
Comment thread .gitignore Outdated
Comment thread src/data-connect/error.ts Outdated

@lahirumaramba lahirumaramba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@stephenarosaj stephenarosaj merged commit 22255fb into main Jun 17, 2026
19 checks passed
@stephenarosaj stephenarosaj deleted the rosa/emulator-error-fix branch June 17, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:stage Stage a release candidate release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants