Simple application where I configure the firebase ...
import * as firebase from "firebase/app";
import 'firebase/auth';
const app = firebase.initializeApp(FIREBASE_CONFIG);
firebase.setLogLevel('debug');
app.auth().useDeviceLanguage();
app.auth().settings.appVerificationDisabledForTesting = __DEVELOPMENT__;
Then I configure the database
import 'firebase/firestore';
const database = app.firestore();
database.settings({
host: 'localhost:8080',
ssl: true,
});
With anonymous user
const handleAuthStateChanged = (user) => {
if (!user) {
firebase.auth().signInAnonymously();
}
}
app.auth().onAuthStateChanged(handleAuthStateChanged)
And I tried to get some data
database.collection('events').doc(eventId).withConverter(eventConverter).get();
But I'm receiving this error
@firebase/firestore: Firestore (7.15.0): FirestoreClient Initializing. user= @firebase/firestore: Firestore (7.15.0): MemoryPersistence Starting transaction: Get next mutation batch @firebase/firestore: Firestore (7.15.0): MemoryPersistence Starting transaction: Allocate target @firebase/firestore: Firestore (7.15.0): MemoryPersistence Starting transaction: Execute query @firebase/firestore: Firestore (7.15.0): IndexFreeQueryEngine Using full collection scan to execute query: Query(target=Target(events/1, orderBy: [name (asc)]); limitType=F) @firebase/firestore: Firestore (7.15.0): PersistentStream close with error: FirebaseError: [code=unknown]: Fetching auth token failed: Cannot redefine property: refreshToken
@firebase/firestore: Firestore (7.15.0): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unknown]: Fetching auth token failed: Cannot redefine property: refreshToken
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
and
FirebaseError: Failed to get document because the client is offline.
Works once I publish
If you go to .. https://nps-event.ridermansb.dev/event/1 you will see that it's working.
But locally is not working
Full source code here