NativeScript / NativeScript/firebase

[IOS] The default FirebaseApp instance must be configured before the default Authinstance can be initialized

Open
#119 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
62
Forks
53
Avg merge
8d 4h
Merged PRs (30d)
2

Description

Hi @NathanWalker

When I call firebase().auth().addAuthStateChangeListener that will throw error

 NativeScript encountered a fatal error: Uncaught Error: The default FirebaseApp instance must be configured before the default Authinstance can be initialized. One way to ensure this is to call `FirebaseApp.configure()` in the App Delegate's `
  application(_:didFinishLaunchingWithOptions:)` (or the `@main` struct's initializer in SwiftUI).
  at
  get native(file: app/webpack:/--/node_modules/@nativescript/firebase-auth/index.ios.js:1237:0)
  at addAuthStateChangeListener(file: app/webpack:/--/node_modules/@nativescript/firebase-auth/index.ios.js:907:0)

to prevent this error I should declare init on a delegate applicationDidFinishLaunchingWithOptions then it work !

Do you have an idea what happen

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing addAuthStateChangeListener path in app/webpack:/--/node_modules/@nativescript/firebase-auth/index.ios.js, especially the references around lines 907 and 1237. Reproduce the iOS initialization order and compare it with the reported applicationDidFinishLaunchingWithOptions workaround; done means authentication no longer throws when the default Firebase app has not been explicitly configured by the caller.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase, ios, typescript
Domain
authentication, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.