0
votes

How do I set the region in my Web Firebase app? I've deployed functions to us-east4 but they are always called pointed to us-central1?

import * as firebase from "firebase/app";
import "firebase/functions";

firebase.initializeApp(firebaseConfig).functions('us-east4'); // tried it here
firebase.functions().httpsCallable('myFunction')({});

Unfortunately, the reference docs only tell me initialization options are Object so I don't know what can be used there.

--

var functions = firebase.functions("us-east4");

Argument of type '"us-east4"' is not assignable to parameter of type 'App | undefined'.ts(2345)

1

1 Answers

3
votes

Figured it out - I needed to reference the firebase app, not the global firebase import, using firebase.app().functions(region)

import * as firebase from "firebase/app";
import "firebase/functions";
firebase.initializeApp({...})
const functions = firebase.app().functions('us-east4');
const response = await functions.httpsCallable('myFunction');