Skip to content

fix(data-connect): include debugDetails in GraphQL error messages - #3258

Open
mtr002 wants to merge 1 commit into
firebase:mainfrom
mtr002:fix/data-connect-debug-details
Open

mtr002 wants to merge 1 commit into
firebase:mainfrom
mtr002:fix/data-connect-debug-details

Conversation

@mtr002

@mtr002 mtr002 commented Sep 14, 2026

Copy link
Copy Markdown

Description

When a Data Connect operation fails server-side (e.g., SQL runtime error or connection quota issues), the backend returns a generic message: "SQL execution failed" alongside detailed diagnostics in extensions.debugDetails.

Currently, DataConnectApiClient.makeGqlRequest extracts only error.message, completely discarding extensions.debugDetails. As a result, standard Node.js logging only surfaces "SQL execution failed" with no actionable cause.

Issue: firebase/firebase-tools#11068

Changes

  • In DataConnectApiClient.makeGqlRequest, format GraphQL errors to append error.extensions.debugDetails to error.message when present.
  • In DataConnectApiClient.toFirebaseError, format data.errors when present on non-200 HTTP responses rather than falling back to "Unknown server error".
  • Zero public API or type changes; FirebaseDataConnectError remains unchanged.

Testing

  • Added unit tests in data-connect-api-client-internal.spec.ts for:
    • GraphQL errors with extensions.debugDetails.
    • Multiple GraphQL errors joined with ; .
    • Non-200 HTTP responses containing GraphQL error arrays.
  • Verified with npm run lint and npm test.

@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 refactors GraphQL error handling in the Data Connect API client by introducing a new helper function, formatGraphqlErrors, which formats errors and appends debugDetails when available. It also adds support for parsing and formatting GraphQL errors from non-200 HTTP responses, backed by comprehensive unit tests. The reviewer suggested using optional chaining within the formatting helper to prevent potential runtime crashes if malformed error objects are received.

Comment thread src/data-connect/data-connect-api-client-internal.ts
@mtr002
mtr002 force-pushed the fix/data-connect-debug-details branch from 51ab466 to fd4045c Compare September 14, 2026 23:33
Comment thread src/data-connect/data-connect-api-client-internal.ts
@mtr002
mtr002 force-pushed the fix/data-connect-debug-details branch from fd4045c to 3fbc7ce Compare September 15, 2026 03:02
@mtr002
mtr002 marked this pull request as ready for review September 15, 2026 03:04

@stephenarosaj stephenarosaj 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

@lahirumaramba lahirumaramba self-assigned this Sep 15, 2026
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