Skip to content

Remove window requirement from remote-config #8785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
7 changes: 4 additions & 3 deletions packages/remote-config/src/client/rest_client.ts
Original file line number Diff line number Diff line change
@@ -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}`;

4 changes: 4 additions & 0 deletions packages/remote-config/src/register.ts
Original file line number Diff line number Diff line change
@@ -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) {