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

Đang mở Phù hợp với người mới
#19,015 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

@ragavendranbala-TSL đang làm issue này rồi.

Từ ngày 27/11/2026.

  • #19016 của @ragavendranbala-TSL — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
dart, ios, macos, swift
Lĩnh vực
backend-api-design, mobile

Hướng nghiên cứu

Bắt đầu với FirebaseFunctionsPlugin.swift, được dùng chung bởi iOS và macOS, rồi theo dõi cách đối số region được truyền đến Functions.functions(app:region:). So sánh lệnh gọi đó với factory Functions.functions(app:customDomain:) của SDK iOS/macOS và cách xử lý trên Android và web được mô tả trong issue. Công việc hoàn tất khi URL miền tùy chỉnh được chuyển đến factory miền tùy chỉnh trên các nền tảng Apple, còn các giá trị region thông thường vẫn dùng factory region.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Dart
Star
9.3k
Fork
4.1k
Merge trung bình
4 ngày 17 giờ
Pull request đã merge (30 ngày)
49

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của firebase/flutterfire

Tất cả issue của firebase/flutterfire

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.