Skip to content

Commit

Permalink
remove window object in clientApp
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyOooh committed Jan 14, 2024
1 parent 4e7486b commit 937562c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/app/src/firebase/clientApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import { connectFirestoreEmulator, getFirestore } from 'firebase/firestore';
import { connectStorageEmulator, getStorage } from 'firebase/storage';
import { connectFunctionsEmulator, getFunctions, httpsCallable } from 'firebase/functions';

/*
* Do NOT use window object or other browser specific objects here
* server components may use this file and buld will fail
*/

const firebaseConfig: FirebaseOptions = {
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
authDomain: 'event-dee-staging.firebaseapp.com',
Expand All @@ -36,7 +41,7 @@ const getCloudFunction = (functionName: string) => {
return returnedFunction;
};

if (process.env.NODE_ENV.match(/development/i) || window.location.hostname === 'localhost') {
if (process.env.NODE_ENV === 'development' || process.env.NEXT_PUBLIC_EMULATORS_ON === 'true') {
connectAuthEmulator(auth, 'http://localhost:9099');
connectFirestoreEmulator(db, 'localhost', 8080);
connectStorageEmulator(storage, 'localhost', 9199);
Expand Down

0 comments on commit 937562c

Please sign in to comment.