-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Feature request: Using Firestore emulator #2183
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
Comments
Apparently I'm supposed to do that: if (window.location.hostname === "localhost") {
db.settings({
host: "localhost:5003",
ssl: false
});
} Is there a way to call .settings via angularfire2 ? |
You can provide |
I'm sorry could you elaborate please? |
You can have something like that in your app.module.ts : @NgModule({
providers: [
{
provide: FirestoreSettingsToken,
useValue: environment.production ? undefined : {
host: 'localhost:8081',
ssl: false
}
}
],
imports: [ ... ],
declarations: [ ... ]
}) |
Merci @GrandSchtroumpf ! T'es un chef ;) |
thanks finally this took me hours before I realised the environment settings can't solve this |
|
Hi!
Thanks! |
Thanks @GrandSchtroumpf for providing that snippet. The docs should be updated to include it probably. |
This works in
|
@rami-alloush I'm trying to get this to work with the export const environment = {
production: false,
firebase: {
host: 'localhost:8080',
ssl: false,
apiKey: '<my-key>',
databaseURL: 'http://localhost:8080?ns=...', // what goes after ns? - not working for me
projectId: 'aerotools-dev',
appId: '<my-app-id>',
measurementId: '<my-measurement-id>',
},
}; Output from running
|
hi @patbrennan, as I understand it, the databaseURL property is only used for firebase database and not Firestore. If you only use Firestore, the properties you need are host and ssl, but these properties cannot be set using the firebase config. |
Thanks everyone, I had the same issue and this works for me as expected:
|
Have look at the example file of the project: app.module.ts. This works for me. |
How about the callable firebase functions? Is there a way to test them locally? |
Edit: Using emulators: Example: HTH! 🚀 |
Not sure if this works for you (as it's from 5 years ago), just got this from the current samples: @NgModule({
imports: [
provideFirebaseApp(() => initializeApp(config)),
provideFirestore(() => {
const firestore = getFirestore();
connectFirestoreEmulator(firestore, 'localhost', 8080);
enableIndexedDbPersistence(firestore);
return firestore;
}),
provideStorage(() => getStorage()),
],
}) |
Version info
**Angular: 8.2.8
**Firebase: 7.0.0
**AngularFire: 5.2.1
Feature Request Details
For now it seems impossible (at least I couldn't find how) to target the Firestore emulator locally.
When I run
firebase emulators:start
it's telling mefirestore: Serving WebChannel traffic on at http://localhost:5003
.Changing the property "databaseURL" to
http://localhost:5003
in the firebase config doesn't seem to workSo I guess that's not an option for now?
Thanks
The text was updated successfully, but these errors were encountered: