From 02ca42e7eeb167f9b64ecd806376ec9a87ff1d61 Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Fri, 7 Feb 2025 15:41:33 -0500 Subject: [PATCH 1/8] Implementation --- packages/firestore/src/lite-api/database.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/firestore/src/lite-api/database.ts b/packages/firestore/src/lite-api/database.ts index 9ea4d4ec52e..8c1e075d779 100644 --- a/packages/firestore/src/lite-api/database.ts +++ b/packages/firestore/src/lite-api/database.ts @@ -24,6 +24,7 @@ import { } from '@firebase/app'; import { createMockUserToken, + deepEqual, EmulatorMockTokenOptions, getDefaultEmulatorHostnameAndPort } from '@firebase/util'; @@ -324,12 +325,20 @@ export function connectFirestoreEmulator( 'will be used.' ); } - - firestore._setSettings({ + const privateSettings = { ...settings, host: newHostSetting, ssl: false - }); + }; + + // Turn this invocation into a no-op if the new configuration matches the current configuration. + // This helps support SSR enviornments where `connectFirestoreEmulator` could be called multiple + // times. + if(deepEqual(privateSettings, settings)) { + return; + } + + firestore._setSettings(privateSettings); if (options.mockUserToken) { let token: string; From 7dce48552e2e41ed8806fb603f646496522787ef Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Fri, 7 Feb 2025 16:43:06 -0500 Subject: [PATCH 2/8] getPrivateSettings --- common/api-review/firestore-lite.api.md | 1 + packages/firestore/src/lite-api/database.ts | 32 +++++++++++++++------ packages/firestore/src/lite-api/settings.ts | 2 ++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/common/api-review/firestore-lite.api.md b/common/api-review/firestore-lite.api.md index 603e2349505..4a9ef4c0171 100644 --- a/common/api-review/firestore-lite.api.md +++ b/common/api-review/firestore-lite.api.md @@ -494,4 +494,5 @@ export class WriteBatch { // @public export function writeBatch(firestore: Firestore): WriteBatch; + ``` diff --git a/packages/firestore/src/lite-api/database.ts b/packages/firestore/src/lite-api/database.ts index 8c1e075d779..873a54a35f4 100644 --- a/packages/firestore/src/lite-api/database.ts +++ b/packages/firestore/src/lite-api/database.ts @@ -72,6 +72,7 @@ export class Firestore implements FirestoreService { private _settings = new FirestoreSettingsImpl({}); private _settingsFrozen = false; + private _emulatorOptions? : { mockUserToken?: EmulatorMockTokenOptions | string; }; // A task that is assigned when the terminate() is invoked and resolved when // all components have shut down. Otherwise, Firestore is not terminated, @@ -120,6 +121,8 @@ export class Firestore implements FirestoreService { ); } this._settings = new FirestoreSettingsImpl(settings); + this._emulatorOptions = settings.emulatorOptions; + if (settings.credentials !== undefined) { this._authCredentials = makeAuthCredentialsProvider(settings.credentials); } @@ -129,6 +132,17 @@ export class Firestore implements FirestoreService { return this._settings; } + _getPrivateSettings() : PrivateSettings { + const privateSettings : PrivateSettings = { + ...this._settings, + emulatorOptions: this._emulatorOptions + }; + if(this._settings.localCache !== undefined) { + privateSettings.localCache = this._settings.localCache; + } + return privateSettings; + } + _freezeSettings(): FirestoreSettingsImpl { this._settingsFrozen = true; return this._settings; @@ -316,7 +330,7 @@ export function connectFirestoreEmulator( } = {} ): void { firestore = cast(firestore, Firestore); - const settings = firestore._getSettings(); + const settings = firestore._getPrivateSettings(); const newHostSetting = `${host}:${port}`; if (settings.host !== DEFAULT_HOST && settings.host !== newHostSetting) { @@ -325,20 +339,22 @@ export function connectFirestoreEmulator( 'will be used.' ); } - const privateSettings = { + const newSettings = { ...settings, host: newHostSetting, - ssl: false + ssl: false, + emulatorOptions: options }; - // Turn this invocation into a no-op if the new configuration matches the current configuration. - // This helps support SSR enviornments where `connectFirestoreEmulator` could be called multiple - // times. - if(deepEqual(privateSettings, settings)) { + // No-op if the new configuration matches the current configuration. This supports SSR + // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice. + if(deepEqual(newSettings, settings)) { + console.error("DEDB settings are the same!"); return; } + console.error("DEDB settings differ!") - firestore._setSettings(privateSettings); + firestore._setSettings(newSettings); if (options.mockUserToken) { let token: string; diff --git a/packages/firestore/src/lite-api/settings.ts b/packages/firestore/src/lite-api/settings.ts index 20551111a4f..4321e407cfd 100644 --- a/packages/firestore/src/lite-api/settings.ts +++ b/packages/firestore/src/lite-api/settings.ts @@ -29,6 +29,7 @@ import { import { LRU_MINIMUM_CACHE_SIZE_BYTES } from '../local/lru_garbage_collector_impl'; import { Code, FirestoreError } from '../util/error'; import { validateIsNotUsedTogether } from '../util/input_validation'; +import { EmulatorMockTokenOptions } from '@firebase/util'; // settings() defaults: export const DEFAULT_HOST = 'firestore.googleapis.com'; @@ -80,6 +81,7 @@ export interface PrivateSettings extends FirestoreSettings { experimentalAutoDetectLongPolling?: boolean; experimentalLongPollingOptions?: ExperimentalLongPollingOptions; useFetchStreams?: boolean; + emulatorOptions?: { mockUserToken?: EmulatorMockTokenOptions | string; }; localCache?: FirestoreLocalCache; } From 464c68e0d213033393a940e9b9195977b31f552c Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Sat, 8 Feb 2025 20:21:54 -0500 Subject: [PATCH 3/8] internal getSettings returns PrivateSettings --- packages/firestore/src/lite-api/database.ts | 24 ++++++++++----------- packages/firestore/src/lite-api/settings.ts | 5 +++-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/packages/firestore/src/lite-api/database.ts b/packages/firestore/src/lite-api/database.ts index 873a54a35f4..2a82812f341 100644 --- a/packages/firestore/src/lite-api/database.ts +++ b/packages/firestore/src/lite-api/database.ts @@ -72,7 +72,9 @@ export class Firestore implements FirestoreService { private _settings = new FirestoreSettingsImpl({}); private _settingsFrozen = false; - private _emulatorOptions? : { mockUserToken?: EmulatorMockTokenOptions | string; }; + private _emulatorOptions?: { + mockUserToken?: EmulatorMockTokenOptions | string; + }; // A task that is assigned when the terminate() is invoked and resolved when // all components have shut down. Otherwise, Firestore is not terminated, @@ -122,22 +124,18 @@ export class Firestore implements FirestoreService { } this._settings = new FirestoreSettingsImpl(settings); this._emulatorOptions = settings.emulatorOptions; - + if (settings.credentials !== undefined) { this._authCredentials = makeAuthCredentialsProvider(settings.credentials); } } - _getSettings(): FirestoreSettingsImpl { - return this._settings; - } - - _getPrivateSettings() : PrivateSettings { - const privateSettings : PrivateSettings = { + _getSettings(): PrivateSettings { + const privateSettings: PrivateSettings = { ...this._settings, emulatorOptions: this._emulatorOptions }; - if(this._settings.localCache !== undefined) { + if (this._settings.localCache !== undefined) { privateSettings.localCache = this._settings.localCache; } return privateSettings; @@ -330,7 +328,7 @@ export function connectFirestoreEmulator( } = {} ): void { firestore = cast(firestore, Firestore); - const settings = firestore._getPrivateSettings(); + const settings = firestore._getSettings(); const newHostSetting = `${host}:${port}`; if (settings.host !== DEFAULT_HOST && settings.host !== newHostSetting) { @@ -348,11 +346,11 @@ export function connectFirestoreEmulator( // No-op if the new configuration matches the current configuration. This supports SSR // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice. - if(deepEqual(newSettings, settings)) { - console.error("DEDB settings are the same!"); + if (deepEqual(newSettings, settings)) { + console.error('DEDB settings are the same!'); return; } - console.error("DEDB settings differ!") + console.error('DEDB settings differ!'); firestore._setSettings(newSettings); diff --git a/packages/firestore/src/lite-api/settings.ts b/packages/firestore/src/lite-api/settings.ts index 4321e407cfd..a1bba373d13 100644 --- a/packages/firestore/src/lite-api/settings.ts +++ b/packages/firestore/src/lite-api/settings.ts @@ -15,6 +15,8 @@ * limitations under the License. */ +import { EmulatorMockTokenOptions } from '@firebase/util'; + import { FirestoreLocalCache } from '../api/cache_config'; import { CredentialsSettings } from '../api/credentials'; import { @@ -29,7 +31,6 @@ import { import { LRU_MINIMUM_CACHE_SIZE_BYTES } from '../local/lru_garbage_collector_impl'; import { Code, FirestoreError } from '../util/error'; import { validateIsNotUsedTogether } from '../util/input_validation'; -import { EmulatorMockTokenOptions } from '@firebase/util'; // settings() defaults: export const DEFAULT_HOST = 'firestore.googleapis.com'; @@ -81,7 +82,7 @@ export interface PrivateSettings extends FirestoreSettings { experimentalAutoDetectLongPolling?: boolean; experimentalLongPollingOptions?: ExperimentalLongPollingOptions; useFetchStreams?: boolean; - emulatorOptions?: { mockUserToken?: EmulatorMockTokenOptions | string; }; + emulatorOptions?: { mockUserToken?: EmulatorMockTokenOptions | string }; localCache?: FirestoreLocalCache; } From 8d0a11d5261bddfde9798f2357defdaf52964812 Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Sun, 9 Feb 2025 19:54:23 -0500 Subject: [PATCH 4/8] getPrivateSettings and tests --- packages/firestore/src/lite-api/database.ts | 8 ++++-- .../test/integration/api/validation.test.ts | 28 ++++++++++++++++++- .../firestore/test/unit/api/database.test.ts | 13 +++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/packages/firestore/src/lite-api/database.ts b/packages/firestore/src/lite-api/database.ts index 2a82812f341..0be63e9f98f 100644 --- a/packages/firestore/src/lite-api/database.ts +++ b/packages/firestore/src/lite-api/database.ts @@ -130,7 +130,11 @@ export class Firestore implements FirestoreService { } } - _getSettings(): PrivateSettings { + _getSettings(): FirestoreSettingsImpl { + return this._settings; + } + + _getPrivateSettings(): PrivateSettings { const privateSettings: PrivateSettings = { ...this._settings, emulatorOptions: this._emulatorOptions @@ -328,7 +332,7 @@ export function connectFirestoreEmulator( } = {} ): void { firestore = cast(firestore, Firestore); - const settings = firestore._getSettings(); + const settings = firestore._getPrivateSettings(); const newHostSetting = `${host}:${port}`; if (settings.host !== DEFAULT_HOST && settings.host !== newHostSetting) { diff --git a/packages/firestore/test/integration/api/validation.test.ts b/packages/firestore/test/integration/api/validation.test.ts index 31f9d144142..6e12e6c4b79 100644 --- a/packages/firestore/test/integration/api/validation.test.ts +++ b/packages/firestore/test/integration/api/validation.test.ts @@ -179,7 +179,7 @@ apiDescribe('Validation:', persistence => { validationIt( persistence, - 'disallows calling connectFirestoreEmulator() after use', + 'disallows calling connectFirestoreEmulator() for first time after use', async db => { const errorMsg = 'Firestore has already been started and its settings can no longer be changed.'; @@ -191,6 +191,32 @@ apiDescribe('Validation:', persistence => { } ); + validationIt( + persistence, + 'allows calling connectFirestoreEmulator() after use with same config', + async db => { + connectFirestoreEmulator(db, '127.0.0.1', 9000); + await setDoc(doc(db, 'foo/bar'), {}); + expect(() => + connectFirestoreEmulator(db, '127.0.0.1', 9000) + ).to.not.throw(); + } + ); + + validationIt( + persistence, + 'disallows calling connectFirestoreEmulator() after use with different config', + async db => { + const errorMsg = + 'Firestore has already been started and its settings can no longer be changed.'; + connectFirestoreEmulator(db, '127.0.0.1', 9000); + await setDoc(doc(db, 'foo/bar'), {}); + expect(() => connectFirestoreEmulator(db, '127.0.0.1', 9001)).to.throw( + errorMsg + ); + } + ); + validationIt( persistence, 'connectFirestoreEmulator() can set mockUserToken object', diff --git a/packages/firestore/test/unit/api/database.test.ts b/packages/firestore/test/unit/api/database.test.ts index fd0e81cd05b..edc2102da55 100644 --- a/packages/firestore/test/unit/api/database.test.ts +++ b/packages/firestore/test/unit/api/database.test.ts @@ -553,6 +553,19 @@ describe('Settings', () => { expect(db._getSettings().ssl).to.be.false; }); + it('gets privateSettings from useEmulator', () => { + // Use a new instance of Firestore in order to configure settings. + const db = newTestFirestore(); + const emulatorOptions = { mockUserToken: 'test' }; + connectFirestoreEmulator(db, '127.0.0.1', 9000, emulatorOptions); + + expect(db._getPrivateSettings().host).to.exist.and.to.equal( + '127.0.0.1:9000' + ); + expect(db._getPrivateSettings().ssl).to.exist.and.to.be.false; + expect(db._getPrivateSettings().emulatorOptions).to.equal(emulatorOptions); + }); + it('prefers host from useEmulator to host from settings', () => { // Use a new instance of Firestore in order to configure settings. const db = newTestFirestore(); From 4a49493157177c131bc1b54ef92b75f324450f4d Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Sun, 9 Feb 2025 20:18:05 -0500 Subject: [PATCH 5/8] Guard validation tests with USE_EMULATOR --- .../test/integration/api/validation.test.ts | 55 ++++++++++--------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/packages/firestore/test/integration/api/validation.test.ts b/packages/firestore/test/integration/api/validation.test.ts index 6e12e6c4b79..0528c451a63 100644 --- a/packages/firestore/test/integration/api/validation.test.ts +++ b/packages/firestore/test/integration/api/validation.test.ts @@ -64,7 +64,8 @@ import { import { ALT_PROJECT_ID, DEFAULT_PROJECT_ID, - TARGET_DB_ID + TARGET_DB_ID, + USE_EMULATOR } from '../util/settings'; // We're using 'as any' to pass invalid values to APIs for testing purposes. @@ -177,6 +178,18 @@ apiDescribe('Validation:', persistence => { } ); + validationIt( + persistence, + 'connectFirestoreEmulator() can set mockUserToken object', + () => { + const db = newTestFirestore(newTestApp('test-project')); + // Verify that this doesn't throw. + connectFirestoreEmulator(db, '127.0.0.1', 9000, { + mockUserToken: { sub: 'foo' } + }); + } + ); + validationIt( persistence, 'disallows calling connectFirestoreEmulator() for first time after use', @@ -195,11 +208,13 @@ apiDescribe('Validation:', persistence => { persistence, 'allows calling connectFirestoreEmulator() after use with same config', async db => { - connectFirestoreEmulator(db, '127.0.0.1', 9000); - await setDoc(doc(db, 'foo/bar'), {}); - expect(() => - connectFirestoreEmulator(db, '127.0.0.1', 9000) - ).to.not.throw(); + if (USE_EMULATOR) { + connectFirestoreEmulator(db, '127.0.0.1', 9000); + await setDoc(doc(db, 'foo/bar'), {}); + expect(() => + connectFirestoreEmulator(db, '127.0.0.1', 9000) + ).to.not.throw(); + } } ); @@ -207,25 +222,15 @@ apiDescribe('Validation:', persistence => { persistence, 'disallows calling connectFirestoreEmulator() after use with different config', async db => { - const errorMsg = - 'Firestore has already been started and its settings can no longer be changed.'; - connectFirestoreEmulator(db, '127.0.0.1', 9000); - await setDoc(doc(db, 'foo/bar'), {}); - expect(() => connectFirestoreEmulator(db, '127.0.0.1', 9001)).to.throw( - errorMsg - ); - } - ); - - validationIt( - persistence, - 'connectFirestoreEmulator() can set mockUserToken object', - () => { - const db = newTestFirestore(newTestApp('test-project')); - // Verify that this doesn't throw. - connectFirestoreEmulator(db, '127.0.0.1', 9000, { - mockUserToken: { sub: 'foo' } - }); + if (USE_EMULATOR) { + const errorMsg = + 'Firestore has already been started and its settings can no longer be changed.'; + connectFirestoreEmulator(db, '127.0.0.1', 9000); + await setDoc(doc(db, 'foo/bar'), {}); + expect(() => + connectFirestoreEmulator(db, '127.0.0.1', 9001) + ).to.throw(errorMsg); + } } ); From d9168d5bf906612add5e85e118708816f97c0021 Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Mon, 10 Feb 2025 09:17:29 -0500 Subject: [PATCH 6/8] Dynamic port for tests. --- .../test/integration/api/validation.test.ts | 13 ++++++++----- .../firestore/test/integration/util/settings.ts | 4 ++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/firestore/test/integration/api/validation.test.ts b/packages/firestore/test/integration/api/validation.test.ts index 0528c451a63..9c74634affa 100644 --- a/packages/firestore/test/integration/api/validation.test.ts +++ b/packages/firestore/test/integration/api/validation.test.ts @@ -65,7 +65,8 @@ import { ALT_PROJECT_ID, DEFAULT_PROJECT_ID, TARGET_DB_ID, - USE_EMULATOR + USE_EMULATOR, + getEmulatorPort } from '../util/settings'; // We're using 'as any' to pass invalid values to APIs for testing purposes. @@ -209,10 +210,11 @@ apiDescribe('Validation:', persistence => { 'allows calling connectFirestoreEmulator() after use with same config', async db => { if (USE_EMULATOR) { - connectFirestoreEmulator(db, '127.0.0.1', 9000); + const port = getEmulatorPort(); + connectFirestoreEmulator(db, '127.0.0.1', port); await setDoc(doc(db, 'foo/bar'), {}); expect(() => - connectFirestoreEmulator(db, '127.0.0.1', 9000) + connectFirestoreEmulator(db, '127.0.0.1', port) ).to.not.throw(); } } @@ -225,10 +227,11 @@ apiDescribe('Validation:', persistence => { if (USE_EMULATOR) { const errorMsg = 'Firestore has already been started and its settings can no longer be changed.'; - connectFirestoreEmulator(db, '127.0.0.1', 9000); + const port = getEmulatorPort(); + connectFirestoreEmulator(db, '127.0.0.1', port); await setDoc(doc(db, 'foo/bar'), {}); expect(() => - connectFirestoreEmulator(db, '127.0.0.1', 9001) + connectFirestoreEmulator(db, '127.0.0.1', port + 1) ).to.throw(errorMsg); } } diff --git a/packages/firestore/test/integration/util/settings.ts b/packages/firestore/test/integration/util/settings.ts index 14bd4456c43..6fcb513a9a9 100644 --- a/packages/firestore/test/integration/util/settings.ts +++ b/packages/firestore/test/integration/util/settings.ts @@ -110,6 +110,10 @@ function getFirestoreHost(targetBackend: TargetBackend): string { } } +export function getEmulatorPort(): number { + return parseInt(process.env.FIRESTORE_EMULATOR_PORT || '8080', 10); +} + function getSslEnabled(targetBackend: TargetBackend): boolean { return targetBackend !== TargetBackend.EMULATOR; } From de0b1e33ce1e7bb185e680407466b9a6e5d992dc Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Mon, 10 Feb 2025 09:55:35 -0500 Subject: [PATCH 7/8] Remove _getPrivateSettings --- packages/firestore/src/lite-api/database.ts | 31 +++++++++---------- .../firestore/test/unit/api/database.test.ts | 8 ++--- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/packages/firestore/src/lite-api/database.ts b/packages/firestore/src/lite-api/database.ts index 0be63e9f98f..f9e5394a526 100644 --- a/packages/firestore/src/lite-api/database.ts +++ b/packages/firestore/src/lite-api/database.ts @@ -72,9 +72,9 @@ export class Firestore implements FirestoreService { private _settings = new FirestoreSettingsImpl({}); private _settingsFrozen = false; - private _emulatorOptions?: { + private _emulatorOptions: { mockUserToken?: EmulatorMockTokenOptions | string; - }; + } = {}; // A task that is assigned when the terminate() is invoked and resolved when // all components have shut down. Otherwise, Firestore is not terminated, @@ -123,7 +123,7 @@ export class Firestore implements FirestoreService { ); } this._settings = new FirestoreSettingsImpl(settings); - this._emulatorOptions = settings.emulatorOptions; + this._emulatorOptions = settings.emulatorOptions || {}; if (settings.credentials !== undefined) { this._authCredentials = makeAuthCredentialsProvider(settings.credentials); @@ -134,15 +134,8 @@ export class Firestore implements FirestoreService { return this._settings; } - _getPrivateSettings(): PrivateSettings { - const privateSettings: PrivateSettings = { - ...this._settings, - emulatorOptions: this._emulatorOptions - }; - if (this._settings.localCache !== undefined) { - privateSettings.localCache = this._settings.localCache; - } - return privateSettings; + _getEmulatorOptions(): { mockUserToken?: EmulatorMockTokenOptions | string } { + return this._emulatorOptions; } _freezeSettings(): FirestoreSettingsImpl { @@ -332,16 +325,20 @@ export function connectFirestoreEmulator( } = {} ): void { firestore = cast(firestore, Firestore); - const settings = firestore._getPrivateSettings(); - const newHostSetting = `${host}:${port}`; + const settings = firestore._getSettings(); + const existingConfig = { + ...settings, + emultorOptions: firestore._getEmulatorOptions() + }; + const newHostSetting = `${host}:${port}`; if (settings.host !== DEFAULT_HOST && settings.host !== newHostSetting) { logWarn( 'Host has been set in both settings() and connectFirestoreEmulator(), emulator host ' + 'will be used.' ); } - const newSettings = { + const newConfig = { ...settings, host: newHostSetting, ssl: false, @@ -350,13 +347,13 @@ export function connectFirestoreEmulator( // No-op if the new configuration matches the current configuration. This supports SSR // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice. - if (deepEqual(newSettings, settings)) { + if (deepEqual(newConfig, existingConfig)) { console.error('DEDB settings are the same!'); return; } console.error('DEDB settings differ!'); - firestore._setSettings(newSettings); + firestore._setSettings(newConfig); if (options.mockUserToken) { let token: string; diff --git a/packages/firestore/test/unit/api/database.test.ts b/packages/firestore/test/unit/api/database.test.ts index edc2102da55..1cc1df51063 100644 --- a/packages/firestore/test/unit/api/database.test.ts +++ b/packages/firestore/test/unit/api/database.test.ts @@ -559,11 +559,9 @@ describe('Settings', () => { const emulatorOptions = { mockUserToken: 'test' }; connectFirestoreEmulator(db, '127.0.0.1', 9000, emulatorOptions); - expect(db._getPrivateSettings().host).to.exist.and.to.equal( - '127.0.0.1:9000' - ); - expect(db._getPrivateSettings().ssl).to.exist.and.to.be.false; - expect(db._getPrivateSettings().emulatorOptions).to.equal(emulatorOptions); + expect(db._getSettings().host).to.exist.and.to.equal('127.0.0.1:9000'); + expect(db._getSettings().ssl).to.exist.and.to.be.false; + expect(db._getEmulatorOptions()).to.equal(emulatorOptions); }); it('prefers host from useEmulator to host from settings', () => { From f0c797c237643c70fda474106e6ede6345529aa7 Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Mon, 10 Feb 2025 11:12:53 -0500 Subject: [PATCH 8/8] Remove debug output, fix emulatorOptions typo. --- packages/firestore/src/lite-api/database.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/firestore/src/lite-api/database.ts b/packages/firestore/src/lite-api/database.ts index f9e5394a526..9a68e2a86d6 100644 --- a/packages/firestore/src/lite-api/database.ts +++ b/packages/firestore/src/lite-api/database.ts @@ -328,9 +328,8 @@ export function connectFirestoreEmulator( const settings = firestore._getSettings(); const existingConfig = { ...settings, - emultorOptions: firestore._getEmulatorOptions() + emulatorOptions: firestore._getEmulatorOptions() }; - const newHostSetting = `${host}:${port}`; if (settings.host !== DEFAULT_HOST && settings.host !== newHostSetting) { logWarn( @@ -344,14 +343,11 @@ export function connectFirestoreEmulator( ssl: false, emulatorOptions: options }; - // No-op if the new configuration matches the current configuration. This supports SSR // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice. if (deepEqual(newConfig, existingConfig)) { - console.error('DEDB settings are the same!'); return; } - console.error('DEDB settings differ!'); firestore._setSettings(newConfig);