diff --git a/.changeset/cuddly-baboons-add.md b/.changeset/cuddly-baboons-add.md
new file mode 100644
index 00000000..953cdeed
--- /dev/null
+++ b/.changeset/cuddly-baboons-add.md
@@ -0,0 +1,5 @@
+---
+'@capacitor-firebase/functions': minor
+---
+
+feat(functions): add `regionOrCustomDomain` option to `UseEmulatorOptions`
diff --git a/packages/functions/README.md b/packages/functions/README.md
index 7693517f..a04157d1 100644
--- a/packages/functions/README.md
+++ b/packages/functions/README.md
@@ -179,10 +179,11 @@ On Android, the cleartext traffic must be allowed. On the Capacitor configuratio
#### UseEmulatorOptions
-| Prop | Type | Description | Default | Since |
-| ---------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ----- |
-| **`host`** | string
| The emulator host without any port or scheme. Note when using a Android Emulator device: 10.0.2.2 is the special IP address to connect to the 'localhost' of the host computer. | | 6.1.0 |
-| **`port`** | number
| The emulator port. | 5001
| 6.1.0 |
+| Prop | Type | Description | Default | Since |
+| -------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ----- |
+| **`host`** | string
| The emulator host without any port or scheme. Note when using a Android Emulator device: 10.0.2.2 is the special IP address to connect to the 'localhost' of the host computer. | | 6.1.0 |
+| **`port`** | number
| The emulator port. | 5001
| 6.1.0 |
+| **`regionOrCustomDomain`** | string
| one of: a) The region the callable functions are located in (ex: us-central1) b) A custom domain hosting the callable functions (ex: https://mydomain.com) | | |
### Type Aliases
diff --git a/packages/functions/src/definitions.ts b/packages/functions/src/definitions.ts
index 01a84ee4..6e5e73ff 100644
--- a/packages/functions/src/definitions.ts
+++ b/packages/functions/src/definitions.ts
@@ -123,4 +123,11 @@ export interface UseEmulatorOptions {
* @example 5001
*/
port?: number;
+ /**
+ * The region the callable functions are located in or a custom domain hosting the callable functions.
+ *
+ * @example 'us-central1'
+ * @example 'https://mydomain.com'
+ */
+ regionOrCustomDomain?: string;
}
diff --git a/packages/functions/src/web.ts b/packages/functions/src/web.ts
index cdb4af3b..533f693e 100644
--- a/packages/functions/src/web.ts
+++ b/packages/functions/src/web.ts
@@ -48,7 +48,7 @@ export class FirebaseFunctionsWeb
}
public async useEmulator(options: UseEmulatorOptions): Promise {
- const functions = getFunctions();
+ const functions = getFunctions(undefined, options.regionOrCustomDomain);
const port = options.port || 5001;
connectFunctionsEmulator(functions, options.host, port);
}