capawesome-team / capacitor-firebase

⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the Web.

Home Page:https://capawesome.io/plugins/firebase/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: "DeviceCheckProvider is not supported" when running on Simulator with debug enabled

jjgriff93 opened this issue · comments

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Version

6.0.0

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

Even when initialising app check as per https://github.com/robingenz/capacitor-firebase-plugin-demo/blob/main/src/app/modules/firebase-app-check/firebase-app-check.page.ts, when running in an iOS 17 simulator I get

[error] - {"errorMessage":"The operation couldn’t be completed. The attestation provider DeviceCheckProvider is not supported on current platform and OS version.","message":"The operation couldn’t be completed. The attestation provider DeviceCheckProvider is not supported on current platform and OS version."}
⚡️  [error] - [2024-05-23T15:57:17.076Z]  @firebase/app-check: {"errorMessage":"The operation couldn’t be completed. The attestation provider DeviceCheckProvider is not supported on current platform and OS version."}

This is despite setting debug to true on initialise:

FirebaseAppCheck.initialize({
    debug: true
  }

Which should use the AppCheckDebugProviderFactory. It should also be using AppAttest instead of DeviceCheck however after reading up on some similar issues I believe that's a red herring. It seems that the real issue is that in this plugin, Firebase.configure() is being called BEFORE the AppCheck provider factory is being initialised, which makes it default to DeviceCheck, when as per the docs it should be called after.

I think the solution will simply be to remove the override init that configures firebase before calling the initialize provider function. I've tested adding the DebugProvider init code to my AppDelegate so that it happens before the Capacitor code is executed and that has worked.

Expected behavior

For the AppCheckDebugProvider to be used as expected when debug is enabled.

Reproduction

https://github.com/robingenz/capacitor-firebase-plugin-demo

Steps to reproduce

  1. Build the repo and cap sync ios
  2. Run in an iPhone simulator

Other information

No response

Capacitor doctor

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.0.0
@capacitor/core: 6.0.0
@capacitor/android: 6.0.0
@capacitor/ios: 6.0.0

Installed Dependencies:

@capacitor/cli: 6.0.0
@capacitor/ios: 6.0.0
@capacitor/android: 6.0.0
@capacitor/core: 6.0.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Before submitting

  • I have read and followed the bug report guidelines.
  • I have attached links to possibly related issues and discussions.
  • I understand that incomplete issues (e.g. without reproduction) are closed.

It seems that the real issue is that in this plugin, Firebase.configure() is being called BEFORE the AppCheck provider factory is being initialised, which makes it default to DeviceCheck, when as per the docs it should be called after.

Yes, this is a known issue. We'll fix this in the future. I close this as duplicate of #453.

commented

Same for me