Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/large-windows-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@firebase/auth": patch
"@firebase/data-connect": patch
"@firebase/database": patch
"@firebase/firestore": patch
"@firebase/functions": patch
"@firebase/storage": patch
---

Updated to only show banner when calling connect*Emulator
14 changes: 9 additions & 5 deletions packages/auth/src/core/auth/emulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ import { Auth } from '../../model/public_types';
import { AuthErrorCode } from '../errors';
import { _assert } from '../util/assert';
import { _castAuth } from './auth_impl';
import { deepEqual, isCloudWorkstation, pingServer } from '@firebase/util';
import {
deepEqual,
isCloudWorkstation,
pingServer,
updateEmulatorBanner
} from '@firebase/util';

/**
* Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production
Expand Down Expand Up @@ -97,13 +102,12 @@ export function connectAuthEmulator(
authInternal.emulatorConfig = emulatorConfig;
authInternal.settings.appVerificationDisabledForTesting = true;

if (!disableWarnings) {
emitEmulatorWarning();
}

// Workaround to get cookies in Firebase Studio
if (isCloudWorkstation(host)) {
void pingServer(`${protocol}//${host}${portStr}`);
updateEmulatorBanner('Auth', true);
} else if (!disableWarnings) {
emitEmulatorWarning();
}
}

Expand Down
7 changes: 6 additions & 1 deletion packages/data-connect/src/api/DataConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import {
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { Provider } from '@firebase/component';
import { isCloudWorkstation, pingServer } from '@firebase/util';
import {
isCloudWorkstation,
pingServer,
updateEmulatorBanner
} from '@firebase/util';

import { AppCheckTokenProvider } from '../core/AppCheckTokenProvider';
import { Code, DataConnectError } from '../core/error';
Expand Down Expand Up @@ -241,6 +245,7 @@ export function connectDataConnectEmulator(
// Workaround to get cookies in Firebase Studio
if (isCloudWorkstation(host)) {
void pingServer(`https://${host}${port ? `:${port}` : ''}`);
updateEmulatorBanner('Data Connect', true);
}
dc.enableEmulator({ host, port, sslEnabled });
}
Expand Down
4 changes: 3 additions & 1 deletion packages/database/src/api/Database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import {
EmulatorMockTokenOptions,
getDefaultEmulatorHostnameAndPort,
isCloudWorkstation,
pingServer
pingServer,
updateEmulatorBanner
} from '@firebase/util';

import { AppCheckTokenProvider } from '../core/AppCheckTokenProvider';
Expand Down Expand Up @@ -393,6 +394,7 @@ export function connectDatabaseEmulator(
// Workaround to get cookies in Firebase Studio
if (isCloudWorkstation(host)) {
void pingServer(host);
updateEmulatorBanner('Database', true);
}

// Modify the repo to apply emulator settings
Expand Down
4 changes: 3 additions & 1 deletion packages/firestore/src/lite-api/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import {
EmulatorMockTokenOptions,
getDefaultEmulatorHostnameAndPort,
isCloudWorkstation,
pingServer
pingServer,
updateEmulatorBanner
} from '@firebase/util';

import {
Expand Down Expand Up @@ -336,6 +337,7 @@ export function connectFirestoreEmulator(
const newHostSetting = `${host}:${port}`;
if (useSsl) {
void pingServer(`https://${newHostSetting}`);
updateEmulatorBanner('Firestore', true);
}
if (settings.host !== DEFAULT_HOST && settings.host !== newHostSetting) {
logWarn(
Expand Down
7 changes: 6 additions & 1 deletion packages/functions/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ import { Provider } from '@firebase/component';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { MessagingInternalComponentName } from '@firebase/messaging-interop-types';
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { isCloudWorkstation, pingServer } from '@firebase/util';
import {
isCloudWorkstation,
pingServer,
updateEmulatorBanner
} from '@firebase/util';

export const DEFAULT_REGION = 'us-central1';

Expand Down Expand Up @@ -182,6 +186,7 @@ export function connectFunctionsEmulator(
// Workaround to get cookies in Firebase Studio
if (useSsl) {
void pingServer(functionsInstance.emulatorOrigin);
updateEmulatorBanner('Functions', true);
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/storage/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ import {
createMockUserToken,
EmulatorMockTokenOptions,
isCloudWorkstation,
pingServer
pingServer,
updateEmulatorBanner
} from '@firebase/util';
import { Connection, ConnectionType } from './implementation/connection';

Expand Down Expand Up @@ -150,6 +151,7 @@ export function connectStorageEmulator(
// Workaround to get cookies in Firebase Studio
if (useSsl) {
void pingServer(`https://${storage.host}`);
updateEmulatorBanner('Storage', true);
}
storage._isUsingEmulator = true;
storage._protocol = useSsl ? 'https' : 'http';
Expand Down
Loading