firebase / firebase/flutterfire

[app_check]: iOS build fails with "Cannot find 'RecaptchaProvider' in scope" and "Redundant conformance of 'FlutterError'"

Open
#18,648 4 comments 0 reactions 0 assignees View on GitHub
Needs Attention platform: ios platform: macos plugin: app_check type: bug
Dominant language
Dart
Stars
9.3k
Forks
4.1k
Avg merge
1d 18h
Merged PRs (30d)
52

Description

### Which plugins are affected?

App Check

### Which platforms are affected?

iOS, macOS (any platform where the "recaptcha" Apple/Web provider switch case in `FirebaseAppCheckPlugin.swift` is compiled — this fails at compile time regardless of which provider is actually activated at runtime)

### Description

`firebase_app_check` 0.4.6 and 0.4.7 fail to build on iOS with two Swift compiler errors, unrelated to which App Check provider the app actually activates (we only use `AppleDebugProvider`, never reCAPTCHA):

**1. `Cannot find 'RecaptchaProvider' in scope`**

Introduced in [PR #18505](https://github.com/firebase/flutterfire/pull/18505) ("rCE provider api update", merged 2026-08-03), `FirebaseAppCheckPlugin.swift` calls:

```swift
delegateProvider = RecaptchaProvider(app: app, siteKey: recaptchaSiteKey)
```

`AppCheckCore` (resolved at 11.3.1 in our lockfile) does not expose a class named `RecaptchaProvider`. The actual class is `AppCheckRecaptchaProvider`, declared in `AppCheckCore/AppCheckRecaptchaProvider/Sources/Public/AppCheckRecaptchaProvider.swift`:

```swift
public final class AppCheckRecaptchaProvider: NSObject, AppCheckCoreProvider {
```

Renaming the call site to `AppCheckRecaptchaProvider(app: app, siteKey: recaptchaSiteKey)` does not fix it either — `AppCheckCore` is not implicitly imported by `FirebaseAppCheckPlugin.swift` (only `FirebaseAppCheck` and `FirebaseCore` are), so the type isn't in scope at all until `import AppCheckCore` is added. Even after adding that import, the constructor signature and protocol conformance have changed too: `AppCheckRecaptchaProvider` conforms to `AppCheckCoreProvider`, not `AppCheckProvider`, and its initializer takes `resourceName`/`APIKey` parameters, not `app`/`siteKey`. So this isn't a simple rename — the "recaptcha" case in `configure(app:providerName:debugToken:recaptchaSiteKey:)` needs a real rewrite against the current `AppCheckRecaptchaProvider` API.

**2. `Redundant conformance of 'FlutterError' to protocol 'Error'`**

`FirebaseAppCheckPlugin.swift` declares:

```swift
// swift-format-ignore: AvoidRetroactiveConformances
extension FlutterError: @retroactive Error {}
```

Several other Firebase Flutter plugins already linked into a typical app declare this exact same extension in their own Swift plugin file (confirmed present in `cloud_functions`, `firebase_storage`, `firebase_remote_config`, `firebase_analytics` — at both their currently-latest versions and several versions back). Any app that also depends on one of those (which is effectively every non-trivial FlutterFire app) gets a "redundant conformance" compile error as soon as `firebase_app_check` is added, independent of the `firebase_core` version in use — we reproduced it with `firebase_core` pinned all the way back to 4.13.0 (the last release before its own Objective-C→Swift rewrite in 4.14.0), so it isn't specific to that rewrite either.

### Reproducing the issue

1. Create a fresh Flutter app (or use an existing one) that already depends on at least one other Firebase plugin whose Swift implementation declares `extension FlutterError: @retroactive Error {}` — e.g. `cloud_functions`, `firebase_storage`, `firebase_remote_config`, or `firebase_analytics`.
2. Add `firebase_app_check: ^0.4.6` (or `^0.4.7`).
3. `flutter pub get`, then `cd ios && rm -rf Pods Podfile.lock && pod install` (or just `flutter run -d `), targeting iOS.
4. Build fails with both errors above, regardless of whether `FirebaseAppCheck.instance.activate(...)` is ever called with a debug/device-check/app-attest provider — the file fails to *compile*, not just to run.

We did not need to actually invoke the "recaptcha" provider at runtime to hit this — Swift has to type-check the whole switch statement in `configure(...)` regardless of which case executes.

### Firebase Core version

4.14.0 (also reproduced with 4.13.0, see above)

### Flutter Version

3.44.1 (stable)

### Relevant Log Output

```
Swift Compiler Error (Xcode): Redundant conformance of 'FlutterError' to protocol 'Error'
.../firebase_app_check-0.4.6/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckPlugin.swift:23:37

Swift Compiler Error (Xcode): Cannot find 'RecaptchaProvider' in scope
.../firebase_app_check-0.4.6/ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckPlugin.swift:381:29

Could not build the application for the simulator.
```

### Flutter dependencies

Expand Flutter dependencies snippet

```yaml
firebase_app_check 0.4.6
firebase_core 4.14.0
cloud_functions 6.4.0
firebase_storage 13.5.0
firebase_remote_config 6.6.0
firebase_auth 6.6.1
```

### Additional context and comments

This blocks any app using `firebase_app_check` on iOS alongside `cloud_functions`/`firebase_storage`/`firebase_remote_config`/`firebase_analytics`, which is likely a very common combination.

Possible fix direction for the "recaptcha" case: update it to construct `AppCheckRecaptchaProvider` with its current initializer (`resourceName`/`APIKey`, conforming to `AppCheckCoreProvider` rather than `AppCheckProvider`) and add `import AppCheckCore` to `FirebaseAppCheckPlugin.swift`, since it isn't currently re-exported through `FirebaseAppCheck`. For the duplicate `FlutterError` conformance, since several sibling plugins already declare it, `firebase_app_check` likely doesn't need its own copy at all.

Contributor guide

Open the contributing guide

Research direction

Start in ios/firebase_app_check/Sources/firebase_app_check/FirebaseAppCheckPlugin.swift and compare its reCAPTCHA case with AppCheckCore/AppCheckRecaptchaProvider/Sources/Public/AppCheckRecaptchaProvider.swift. Reproduce the iOS build with another plugin that declares the FlutterError conformance, then verify the current App Check provider API and duplicate-conformance behavior. Done means the listed dependencies compile without either Swift error.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase, ios, swift
Domain
mobile, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
57/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.