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

Abierto Apto para principiantes
#19,015 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

@ragavendranbala-TSL ya está trabajando en esto.

Desde el 27/11/2026.

  • #19016 de @ragavendranbala-TSL — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
dart, ios, macos, swift

Línea de trabajo

Empieza con FirebaseFunctionsPlugin.swift, compartido por iOS y macOS, y sigue cómo llega el argumento region a Functions.functions(app:region:). Compara esa llamada con la factoría Functions.functions(app:customDomain:) del SDK para iOS/macOS y con el manejo descrito en el issue para Android y web. Se considera terminado cuando las URL de dominios personalizados llegan a la factoría de dominios personalizados en las plataformas Apple, mientras que los valores de región habituales siguen usando la factoría de región.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Dart
Estrellas
9.3k
Forks
4.1k
Merge medio
4 d 17 h
PR fusionados (30 d)
49

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firebase/flutterfire

Todos los issues de firebase/flutterfire

Issues similares

Más issues de Dart

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.