Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: The default Firebase app has not yet been configured. Add FirebaseApp.configure() to your application initialization. #752

Closed
5 of 17 tasks
yogo10803 opened this issue Nov 7, 2024 · 7 comments

Comments

@yogo10803
Copy link

Plugin(s)

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

Version

6.1.0

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

using @capacitor-firebase/performance (v6.1.0), but whenever I call FirebasePerformance.startTrace(), the app crashes with the message, "The default Firebase app has not yet been configured. Add FirebaseApp.configure() to your application initialization."

Expected behavior

no crash and successfully collect custom trace data to PerformanceMonitoring dashboard

Reproduction

https://github.com/capawesome-team/capacitor-firebase

Steps to reproduce

I’m using firebase-ios-sdk (v10.25.0) in Xcode and have enabled FirebasePerformance. It has been working for a while, and I can see auto-collected performance data in the Firebase console. Now, I’d like to add custom traces. I tried using @capacitor-firebase/performance (v6.1.0), but whenever I call FirebasePerformance.startTrace(), the app crashes with the message, "The default Firebase app has not yet been configured. Add FirebaseApp.configure() to your application initialization."
I also tried using the 'firebase/performance' package on the backend. There was no error, and I could see API logs following the official Firebase debugging method. However, the API response returned:

{
"nextRequestWaitMillis": "10000",
"logResponseDetails": [
{
"responseAction": "DELETE_REQUEST"
}
]
}
I've been stuck on this issue for several days. Does anyone know what I might be doing wrong, or is it currently impossible to record custom traces in Firebase Performance Monitoring with Capacitor?

Other information

No response

Capacitor doctor

💊 Capacitor Doctor 💊

Latest Dependencies:

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

Installed Dependencies:

@capacitor/cli: 6.0.0-rc.0
@capacitor/core: 5.6.0
@capacitor/android: 5.6.0
@capacitor/ios: 5.6.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.
@yogo10803 yogo10803 added bug/fix Something isn't working needs: triage labels Nov 7, 2024
@robingenz
Copy link
Member

It's definitely possible to record custom traces and we use it ourselves. It seems like you did not follow the setup guide correctly since it's not needed to import any Firebase packages via Xcode yourself. Please provide a Minimal, Reproducible Example so that I can debug your issue.

Copy link
Contributor

github-actions bot commented Nov 7, 2024

This issue has been labeled as needs: reproduction. This label is added to issues that need a code reproduction.

Please provide a Minimal, Reproducible Example using this template in a public GitHub repository so we can debug the issue.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for us to reproduce the issue.

@yogo10803
Copy link
Author

Hello,

Originally, I needed only FirebaseMessaging, FirebasePerformance, and Crashlytics, so I added firebase-ios-sdk version 10.25.0 directly in Xcode using the 'Add Package' feature, enabling only the necessary services. This setup has worked well. However, I recently needed to add custom traces to Performance Monitoring, which requires implementing trace code within my Ionic project. Therefore, I installed @capacitor-firebase/performance version 6.1.0 to add the trace functionality.

In this scenario, should I remove the firebase-ios-sdk from Xcode and rely entirely on the @capacitor-firebase package suite? Or is there any way to allow firebase-ios-sdk and @capacitor-firebase/performance to coexist smoothly?

Thank you!

@robingenz
Copy link
Member

You need to remove the firebase-ios-sdk from Xcode.

@yogo10803
Copy link
Author

Currently, since I need to use logEvent() and setUserProperty() for Analytics, I've kept firebase-ios-sdk in Xcode. With this setup, I've also installed @capacitor-community/firebase-analytics in the Ionic project and am successfully calling functions like FirebaseAnalytics.logEvent()—so they coexist without issues.

However, migrating entirely to capacitor-firebase would be a significant task. I’d like to confirm if there’s any way to have both firebase-ios-sdk and @capacitor-firebase/performance coexist. If it’s truly not possible, I’ll need to reconsider whether to implement this functionality. Thanks!

@robingenz
Copy link
Member

At least it is not officially supported by these plugins and it has never been tested. The advantage of this repository is that you don't have to worry about the versioning of the Firebase SDK. It is ensured that all plugins are compatible with each other.

@yogo10803
Copy link
Author

Got it, I’ll carefully reconsider whether to fully switch to the capacitor-firebase plugins. Thank you very much for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants