Skip to content

Commit 3a2a1ba

Browse files
committed
fix: server app should initialize in web workers
1 parent baa96ce commit 3a2a1ba

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.changeset/fifty-mayflies-hug.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/app': patch
3+
---
4+
5+
fix: server app should initialize in web workers

packages/app/src/api.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ import {
4848
LogOptions,
4949
setUserLogHandler
5050
} from '@firebase/logger';
51-
import { deepEqual, getDefaultAppConfig, isBrowser } from '@firebase/util';
51+
import {
52+
deepEqual,
53+
getDefaultAppConfig,
54+
isBrowser,
55+
isWebWorker
56+
} from '@firebase/util';
5257

5358
export { FirebaseError } from '@firebase/util';
5459

@@ -230,7 +235,7 @@ export function initializeServerApp(
230235
_options: FirebaseOptions | FirebaseApp,
231236
_serverAppConfig: FirebaseServerAppSettings
232237
): FirebaseServerApp {
233-
if (isBrowser()) {
238+
if (isBrowser() && !isWebWorker()) {
234239
// FirebaseServerApp isn't designed to be run in browsers.
235240
throw ERROR_FACTORY.create(AppError.INVALID_SERVER_APP_ENVIRONMENT);
236241
}

0 commit comments

Comments
 (0)