Skip to content

feat(dataconnect): add "X-Firebase-Sqlconnect-Affinity" header for GSLB soft stickiness - #3227

Open
dconeybe wants to merge 2 commits into
mainfrom
dconeybe/dataconnect/GslbStickiness
Open

feat(dataconnect): add "X-Firebase-Sqlconnect-Affinity" header for GSLB soft stickiness#3227
dconeybe wants to merge 2 commits into
mainfrom
dconeybe/dataconnect/GslbStickiness

Conversation

@dconeybe

@dconeybe dconeybe commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

This PR adds the X-Firebase-Sqlconnect-Affinity request header to outgoing Data Connect HTTP requests. This header enables backend server affinity routing for SQL Connect to improve server resource usage efficiency and performance.

Highlights

  • SQL Connect Server Affinity Header: Added the X-Firebase-Sqlconnect-Affinity header containing ${projectId}${serviceId} to Data Connect HTTP request headers.
  • Unit Test Coverage: Updated EXPECTED_HEADERS, EXPECTED_HEADERS_WITH_GEN, and EMULATOR_EXPECTED_HEADERS test fixtures to verify the header key and formatted value.
Changelog
  • data-connect-api-client-internal.ts
    • Added GetHeadersParameters interface and updated getHeaders function to accept parameters by name.
    • Added X-Firebase-Sqlconnect-Affinity header containing ${projectId}${serviceId} to request headers.
    • Updated makeGqlRequest to resolve projectId and pass named parameters to getHeaders.
  • data-connect-api-client-internal.spec.ts
    • Added X-Firebase-Sqlconnect-Affinity header assertion to EXPECTED_HEADERS, EXPECTED_HEADERS_WITH_GEN, and EMULATOR_EXPECTED_HEADERS.

@dconeybe dconeybe self-assigned this Jul 31, 2026

@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 introduces the 'X-Firebase-Sqlconnect-Affinity' header to the Data Connect API client, constructed from the project ID and service ID. The review feedback recommends using a delimiter (such as ':') between the project ID and service ID to avoid potential key collisions and ambiguity, and suggests updating the corresponding unit tests to reflect this change.

Comment thread src/data-connect/data-connect-api-client-internal.ts
Comment thread test/unit/data-connect/data-connect-api-client-internal.spec.ts
Comment thread test/unit/data-connect/data-connect-api-client-internal.spec.ts
Comment thread test/unit/data-connect/data-connect-api-client-internal.spec.ts
@dconeybe
dconeybe marked this pull request as ready for review July 31, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant