Expand file tree Collapse file tree 4 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,12 @@ import { Auth } from '../../model/public_types';
18
18
import { AuthErrorCode } from '../errors' ;
19
19
import { _assert } from '../util/assert' ;
20
20
import { _castAuth } from './auth_impl' ;
21
- import { deepEqual , isCloudWorkstation , pingServer , updateStatus } from '@firebase/util' ;
21
+ import {
22
+ deepEqual ,
23
+ isCloudWorkstation ,
24
+ pingServer ,
25
+ updateStatus
26
+ } from '@firebase/util' ;
22
27
23
28
/**
24
29
* Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production
@@ -98,13 +103,7 @@ export function connectAuthEmulator(
98
103
authInternal . settings . appVerificationDisabledForTesting = true ;
99
104
100
105
if ( ! disableWarnings ) {
101
- updateStatus (
102
- {
103
- name : 'Auth' ,
104
- isRunningEmulator : true
105
- } ,
106
- isCloudWorkstation ( emulatorConfig . host )
107
- ) ;
106
+ emitEmulatorWarning ( isCloudWorkstation ( emulatorConfig . host ) ) ;
108
107
}
109
108
110
109
// Workaround to get cookies in Firebase Studio
@@ -148,3 +147,20 @@ function parsePort(portStr: string): number | null {
148
147
}
149
148
return port ;
150
149
}
150
+
151
+ function emitEmulatorWarning ( isCloudWorkstation : boolean ) : void {
152
+ updateStatus (
153
+ {
154
+ name : 'Auth' ,
155
+ isRunningEmulator : true
156
+ } ,
157
+ isCloudWorkstation
158
+ ) ;
159
+ if ( typeof console !== 'undefined' && typeof console . info === 'function' ) {
160
+ console . info (
161
+ 'WARNING: You are using the Auth Emulator,' +
162
+ ' which is intended for local testing only. Do not use with' +
163
+ ' production credentials.'
164
+ ) ;
165
+ }
166
+ }
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ export class FetchProvider {
37
37
}
38
38
39
39
static fetch ( ) : typeof fetch {
40
- console . log ( 'fetch!' ) ;
41
40
if ( this . fetchImpl ) {
42
41
return this . fetchImpl ;
43
42
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ abstract class FetchConnection<T extends ConnectionType>
51
51
method : string ,
52
52
isUsingEmulator : boolean ,
53
53
body ?: NodeJS . ArrayBufferView | Blob | string ,
54
- headers ?: Record < string , string > ,
54
+ headers ?: Record < string , string >
55
55
) : Promise < void > {
56
56
if ( this . sent_ ) {
57
57
throw internalError ( 'cannot .send() more than once' ) ;
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ export function updateStatus(
173
173
parentDiv . style . borderRadius = '10px' ;
174
174
parentDiv . style . padding = '.5em' ;
175
175
parentDiv . style . textAlign = 'center' ;
176
+ parentDiv . classList . add ( 'firebase-emulator-warning' ) ;
176
177
document . body . appendChild ( parentDiv ) ;
177
178
}
178
179
0 commit comments