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

🔥signInWithCredential() uncaught NSInvalidArgumentException #1993

Closed
5 of 34 tasks
j-cheung opened this issue Mar 20, 2019 · 4 comments
Closed
5 of 34 tasks

🔥signInWithCredential() uncaught NSInvalidArgumentException #1993

j-cheung opened this issue Mar 20, 2019 · 4 comments

Comments

@j-cheung
Copy link

j-cheung commented Mar 20, 2019

Issue


Project Files

iOS

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'Mellow' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # needed for debugging
    # Add any other subspecs you want to use in your project
    'RCTImage'
  ]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Pods for ----
   pod 'Firebase'
   pod 'Firebase/Core', '~> 5.15.0'
   pod 'Firebase/Auth', '~> 5.15.0'
   pod 'Firebase/Messaging'

end
# N/A

AppDelegate.m:

// N/A

Android

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->

Environment

  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • If known, the version of the platform are you experiencing the issue on:
    • ADD_SOMETHING_HERE e.g. iOS 10 or Android API 28
  • Operating System:
    • MacOS, version: 10.14
    • Windows, version: N/A
    • Other, please specify: N/A
  • Build Tools:
    • ADD_SOMETHING_HERE e.g. Xcode 10, Android Studio 3.2
  • React Native version:
    • ADD_SOMETHING_HERE
  • React Native Firebase library version:
    • ADD_SOMETHING_HERE
  • Firebase module(s) you're using that has the issue:
    • N/A
    • Authentication
    • Analytics
    • Cloud Firestore
    • Cloud Messaging (FCM)
    • Crashlytics
    • Dynamic Links
    • Functions Callable
    • In App Messaging
    • Indexing
    • Invites
    • Instance ID
    • ML Kit
    • Notifications
    • Performance Monitoring
    • Realtime Database
    • Remote Config
    • Storage
  • Are you using TypeScript?
    • No
    • Yes, version: N/A
  • Are you using Expo, e.g. ExpoKit?
    • No
    • Yes, I've not ejected
    • Yes, but I have ejected to ExpoKit
    • Yes, but I have ejected to vanilla React Native
    • Expo version: N/A

Hi,

I'm trying to use react-native-firebase and starting off with authentication, but when trying to call signInWithCredential(), I experienced this uncaught exception, and the .catch() or try/catch blocks are not catching them in JS.

firebaseAuth = userId => { try{ firebase.auth().signInWithCredential(userId).then(data => console.warn(data)).catch(function(error){ console.warn(error)}) } catch(err) { console.warn(err) } };

Screenshot 2019-03-20 at 13 01 08

Think react-native-firebase is great? Please consider supporting the project with any of the below:

@ghost
Copy link

ghost commented Mar 22, 2019

Running into something similar with firebase.auth().signInAnonymously().

H8seXYgA

@eliabiraschi
Copy link

I'm experiencing the same on both Android and iOS.

@eliabiraschi
Copy link

eliabiraschi commented Apr 3, 2019

I've changed the signInWithCredential method in node_modules/react-native-firebase/dist/modules/auth/index.js to handle the promise rejection like this:

signInWithCredential(credential) {
    return getNativeModule(this)
      .signInWithCredential(credential.providerId, credential.token, credential.secret)
      .then(
        userCredential => this._setUserCredential(userCredential),
        error => Promise.reject(error) // <-- I've just added this ugliness
      );
  }

and it fixed the issue allowing me to catch and handle the exceptions at the right link of the promises chain as expected (at least on Android - I haven't tested on iOS).
The issue might be related to this one facebook/react-native#20262 and maybe this one too facebook/react-native#24249

@stale stale bot added the Type: Stale Issue has become stale - automatically added by Stale bot label May 1, 2019
@Salakar Salakar added the Keep Open avoids the stale bot label May 1, 2019
@Salakar Salakar added this to the v6.0.0 milestone May 1, 2019
@stale stale bot removed the Type: Stale Issue has become stale - automatically added by Stale bot label May 1, 2019
@invertase invertase deleted a comment from stale bot May 3, 2019
@Salakar
Copy link
Member

Salakar commented Jul 31, 2019

Closing issue as it has since been resolved in later RN versions.

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

No branches or pull requests

3 participants