-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
When using Angular Fire 19.0.0 - Angular 19.1.7 - Firebase function 6.3.2
Function.region are ignore with httpsCallable
appConfig
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes),
provideHttpClient(withInterceptorsFromDi()),
provideAnimationsAsync(),
provideFirebaseApp(() => initializeApp(environment.firebase)),
provideAuth(() => {
const auth: Auth = getAuth(inject(FirebaseApp));
if (environment.useEmulators) {
connectAuthEmulator(auth, `http://localhost:${environment.emulatorPorts.auth}`, { disableWarnings: true });
}
return auth;
}),
provideFirestore(() => {
const firestore: Firestore = initializeFirestore(inject(FirebaseApp),{
localCache: persistentLocalCache(),
});
if (environment.useEmulators) {
connectFirestoreEmulator(firestore, '127.0.0.1', environment.emulatorPorts.firestore);
}
return firestore;
}),
provideFunctions(() => {
const functions: Functions = getFunctions(inject(FirebaseApp), 'europe-west3');
if (environment.useEmulators) {
connectFunctionsEmulator(functions, '127.0.0.1', environment.emulatorPorts.functions);
}
return functions;
}),
provideStorage(() => {
const storage = getStorage(inject(FirebaseApp));
if (environment.useEmulators) {
connectStorageEmulator(storage, '127.0.0.1', environment.emulatorPorts.storage);
}
return storage;
}),
[...]
],
};
getFunctions(inject(FirebaseApp), 'europe-west3');
This should link Functions to 'europe-west3'
Usage in service
import {httpsCallable, Functions, HttpsCallableResult} from '@angular/fire/functions';
@Injectable({
providedIn: 'root'
})
export class MyService {
constructor(private functions: Functions){}
public onCall (){
const doSomething = httpsCallable(this.functions, 'onCallDoSomething');
const response: HttpsCallableResult<any> = await doSomething();
}
}
when onCall(), i get this error:
POST https://us-central1-rentwave-prod.cloudfunctions.net/onCallDoSomething net::ERR_FAILED
us-central1 is the default region.
httpsCallable, doesn't apply region settings and target the wrong region.
Or I may have misunderstood the way to build appConfig
I tried to override the region by adding just before the httpsCallable; With no luck
this.functions.region = "europe-west3"
IMPACT:
firebase httpsFunction are unavailable if not on us-central1
Metadata
Metadata
Assignees
Labels
No labels