feat(dataconnect): add "X-Client-Version" header for cloud monitoring - #3222
Merged
Conversation
…lient-Version" headers Googlers see go/dataconnect:sdk:headers for details
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds 'x-client-platform' and 'x-client-version' headers to the Data Connect API client and updates the corresponding unit tests. The reviewer suggested capitalizing these headers to 'X-Client-Platform' and 'X-Client-Version' in both the implementation and test files to maintain consistency with existing headers.
…ther headers The new headers `'x-client-platform'` and `'x-client-version'` are defined in lowercase, which is inconsistent with the Pascal-Kebab-Case used for other headers in this object (e.g., `'X-Firebase-Client'`, `'X-Goog-Api-Client'`) and the PR title (`X-Client-Platform` and `X-Client-Version`). For consistency and to match the PR description, these should be capitalized. See #3222 (comment)
dconeybe
marked this pull request as ready for review
July 28, 2026 19:46
This change was made because the "X-Client-Platform" header causes the CORS OPTIONS preflight request to fail with a 403 "Permission Denied" error due to that header being absent from Google's list of whitelisted CORS headers. In contrast, the "X-Client-Version" header *is* whitelisted and, therefore, successfully passes the CORS preflight. This problem only affects the JS client SDK, but it affected how all platforms, including firebase-admin-node, send their headers. See firebase/firebase-js-sdk#10217 for details.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the
X-Client-Versionrequest header (formatted asnode/<version>) toDataConnectApiClientto enable metrics collection in Cloud Monitoring.Highlights
X-Client-Versionheader (set tonode/$SDK_VERSION) to outgoing requests inDataConnectApiClientto enable Cloud Monitoring telemetry.X-Client-Versionis correctly attached to API client requests.Changelog
getHeadersto include theX-Client-Versionheader formatted asnode/${utils.getSdkVersion()}in default request headers.X-Client-Versionis included in request headers.