angularfire
angularfire copied to clipboard
Docs: Emulator guide missing breaking changes in >7.0
How to reproduce these conditions
The upgrade guide for v7 mentions a breaking change: "USE_EMULATOR DI token is now in the form of ['http://localhost:9099']". This change is not documented in the Emulators guide. The Emulators guide still shows:
{ provide: USE_AUTH_EMULATOR, useValue: environment.useEmulators ? ['localhost', 9099] : undefined },
This is shown under '6.1 Method'. Something should probably be written for v7+.
This issue does not seem to follow the issue template. Make sure you provide all the required information.
I've been having trouble with using the emulator for the last few weeks and received this bit of code from the firebase-tools group. I had to wrap the connectAuthEmulators with if (environment.useEmulators) and it works with and without the providers specified above.
imports: [
provideAuth(() => {
const auth = getAuth();
if (environment.useEmulators) {
connectAuthEmulator(auth, 'http://localhost:5005', { disableWarnings: true });
}
return auth;
}),
provideFirestore(() => {
const firestore = getFirestore();
if (environment.useEmulators) {
connectFirestoreEmulator(firestore, 'localhost', 5006);
}
return firestore;
}),
]
It would be nice to have a definitive guide.
I found the rest of the sample code at https://github.com/angular/angularfire/blob/57d9005d2e0077d3920e66b5cbcaea1fb7f84450/samples/modular/src/app/app.module.ts . It should be copied to the emulators guide under a new section titled "7.0 Method".