Skip to content

Commit 1287ce0

Browse files
Merge afd9f76 into 364e336
2 parents 364e336 + afd9f76 commit 1287ce0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/firestore/src/platform/node/grpc_connection.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ function createMetadata(
5656
}
5757
}
5858
}
59-
metadata.set('X-Firebase-GMPID', appId);
59+
if (appId) {
60+
metadata.set('X-Firebase-GMPID', appId);
61+
}
6062
metadata.set('X-Goog-Api-Client', X_GOOG_API_CLIENT_VALUE);
6163
// This header is used to improve routing and project isolation by the
6264
// backend.

packages/firestore/src/remote/rest_connection.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,16 @@ export abstract class RestConnection implements Connection {
119119
token: Token | null
120120
): void {
121121
headers['X-Goog-Api-Client'] = X_GOOG_API_CLIENT_VALUE;
122-
headers['X-Firebase-GMPID'] = this.databaseInfo.appId;
123122

124123
// Content-Type: text/plain will avoid preflight requests which might
125124
// mess with CORS and redirects by proxies. If we add custom headers
126125
// we will need to change this code to potentially use the $httpOverwrite
127126
// parameter supported by ESF to avoid triggering preflight requests.
128127
headers['Content-Type'] = 'text/plain';
129128

129+
if (this.databaseInfo.appId) {
130+
headers['X-Firebase-GMPID'] = this.databaseInfo.appId;
131+
}
130132
if (token) {
131133
for (const header in token.authHeaders) {
132134
if (token.authHeaders.hasOwnProperty(header)) {

0 commit comments

Comments
 (0)