diff --git a/packages/remote-config/src/client/rest_client.ts b/packages/remote-config/src/client/rest_client.ts index 57f55f53d88..055744bbb51 100644 --- a/packages/remote-config/src/client/rest_client.ts +++ b/packages/remote-config/src/client/rest_client.ts @@ -76,9 +76,10 @@ export class RestClient implements RemoteConfigFetchClient { this.firebaseInstallations.getToken() ]); - const urlBase = - window.FIREBASE_REMOTE_CONFIG_URL_BASE || - 'https://firebaseremoteconfig.googleapis.com'; + let urlBase = 'https://firebaseremoteconfig.googleapis.com'; + if (typeof window!== 'undefined' && window.FIREBASE_REMOTE_CONFIG_URL_BASE) { + urlBase = window.FIREBASE_REMOTE_CONFIG_URL_BASE; + } const url = `${urlBase}/v1/projects/${this.projectId}/namespaces/${this.namespace}:fetch?key=${this.apiKey}`; diff --git a/packages/remote-config/src/register.ts b/packages/remote-config/src/register.ts index dda6cc544de..e262ea7df4f 100644 --- a/packages/remote-config/src/register.ts +++ b/packages/remote-config/src/register.ts @@ -66,6 +66,10 @@ export function registerRemoteConfig(): void { .getProvider('installations-internal') .getImmediate(); + // Guards against the SDK being used when indexedDB is not available. + if (!isIndexedDBAvailable()) { + throw ERROR_FACTORY.create(ErrorCode.INDEXED_DB_UNAVAILABLE); + } // Normalizes optional inputs. const { projectId, apiKey, appId } = app.options; if (!projectId) {