[cloud_functions]: Apple platforms ignore custom domains passed as region

Open Beginner friendly
#19,015 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

@ragavendranbala-TSL is already working on this.

Since Nov 27, 2026.

  • #19016 by @ragavendranbala-TSL — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
dart, ios, macos, swift

Research direction

Start with FirebaseFunctionsPlugin.swift, shared by iOS and macOS, and trace how the region argument reaches Functions.functions(app:region:). Compare that call with the iOS/macOS SDK’s Functions.functions(app:customDomain:) factory and the Android and web handling described in the issue. Done means custom-domain URLs reach the custom-domain factory on Apple platforms while ordinary region values keep using the region factory.

Written by the indexing model from the issue text.

Description

Needs Attention platform: ios platform: macos plugin: functions type: bug

[cloud_functions]: Apple platforms ignore custom domains passed as region

Which plugins are affected?

Functions

Which platforms are affected?

iOS, macOS

Description

The Android and web Firebase SDKs accept a custom domain in the same
parameter as a region — regionOrCustomDomain. On Android,
FirebaseFunctions.getInstance(app, regionOrCustomDomain) URL-parses the
value and switches to custom-domain mode when it is a URL; the JS SDK's
getFunctions(app, regionOrCustomDomain) does the same.

The Firebase iOS/macOS SDKs also support custom domains, but through a
separate factory: Functions.functions(app:customDomain:). When a custom
domain string is passed to Functions.functions(app:region:) instead, the
SDK interpolates it into the host and produces a malformed URL such as
https://https://example.com-project.cloudfunctions.net/name.

The Flutter plugin always calls Functions.functions(app:region:) and
never exposes the customDomain: factory, so on Apple platforms there is
no way to reach a function through a custom domain — for example a
Google Cloud Load Balancer fronting Cloud Armor, where the function must
be called at https://api.example.com/functionName rather than the
cloudfunctions.net host.

Reproducing the issue

  1. Deploy a callable function behind a custom domain.
  2. Call FirebaseFunctions.instanceFor(region: 'https://api.example.com').httpsCallable('myFunction').call().
  3. On Android and web the call reaches the custom domain. On iOS/macOS it
    fails: the plugin passes the URL string as a region, and the SDK builds
    an invalid cloudfunctions.net URL.

Suggested fix

In FirebaseFunctionsPlugin.swift (shared by iOS and macOS), detect an
http prefix in the region argument and call
Functions.functions(app:customDomain:) instead — matching the
region-or-custom-domain convention the other SDKs already use. This adds
no public Dart API surface.

Dominant language
Dart
Stars
9.3k
Forks
4.1k
Avg merge
4d 17h
Merged PRs (30d)
49

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/flutterfire

All issues in firebase/flutterfire

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.