File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
packages/auth/src/core/auth Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -69,13 +69,27 @@ export function connectAuthEmulator(
6969 options : Object . freeze ( { disableWarnings } )
7070 } ) ;
7171
72+ // There are a few scenarios to guard against if the Auth instance has already started:
7273 if ( ! authInternal . _canInitEmulator ) {
74+ // Applications may not initialize the emulator for the first time if Auth has already started
75+ // to make network requests.
7376 _assert (
74- deepEqual ( emulator , authInternal . config . emulator || { } ) &&
75- deepEqual ( emulatorConfig , authInternal . emulatorConfig || { } ) ,
77+ authInternal . config . emulator && authInternal . emulatorConfig ,
7678 authInternal ,
7779 AuthErrorCode . EMULATOR_CONFIG_FAILED
7880 ) ;
81+
82+ // Applications may not alter the configuration of the emulator (aka pass a different config)
83+ // once Auth has started to make network requests.
84+ _assert (
85+ deepEqual ( emulator , authInternal . config . emulator ) &&
86+ deepEqual ( emulatorConfig , authInternal . emulatorConfig ) ,
87+ authInternal ,
88+ AuthErrorCode . EMULATOR_CONFIG_FAILED
89+ ) ;
90+
91+ // It's valid, however, to invoke connectAuthEmulator() after Auth has started making
92+ // connections, so long as the config matches the existing config. This results in a no-op.
7993 return ;
8094 }
8195
You can’t perform that action at this time.
0 commit comments