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

fix(firebase_auth_platform_interface): details['code'] null check #10119

Merged
merged 1 commit into from Dec 15, 2022

Conversation

Yokoi-K
Copy link
Contributor

@Yokoi-K Yokoi-K commented Dec 15, 2022

Description

My team detected the following error logs while using this plugin.

_TypeError
type 'Null' is not a subtype of type 'String'

method_channel_firebase_auth.dart in MethodChannelFirebaseAuth.verifyPhoneNumber.<fn> at line 660 within firebase_auth_platform_interface


https://github.com/firebase/flutterfire/blob/master/packages/firebase_auth/firebase_auth_platform_interface/lib/src/method_channel/method_channel_firebase_auth.dart#L660

Apparently, details['code'] is sometimes null, and code is a non-null definition, so we need to do a good null check.

Related Issues

Replace this paragraph with a list of issues related to this PR from the issue database. Indicate, which of these issues are resolved or fixed by this PR. Note that you'll have to prefix the issue numbers with flutter/flutter#.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@Lyokone
Copy link
Contributor

Lyokone commented Dec 15, 2022

Thanks for this :)

@mariopepe
Copy link

mariopepe commented Dec 19, 2022

First of all thanks a lot @Yokoi-K .
I was having the issue that was addressed with this PR, so I am thankful for it.

My situation was the following:

  1. the user was inserting phone number (note: my data, might be wrong, tell me that this is something that happened most of the times with users signing up for the first time ever)
  2. the user was receiving the OTP code
  3. the user was inserting the correct OTP
  4. but was not able to access complete the verification (i.e. I was calling the method signInWithCredential with the correct smsCode and verificationId but the authentication created problems).

Now since this fix (thanks again!) I am not seeing anymore this error, but looking at my crash and analytics data, it still seems that my users have difficulties while performing successful authentication from Android (same as before).

So my question for you is:
did you had the chance to investigate which were the reasons that, in the first place, where generating that FirebaseAuthException for your users? Did you had the chance to verify that the AuthException was raised, in the first place, for good reasons?
My speculation, might be wrong, is that this exception is being thrown for some bug elsewhere in the plugin and now with this PR we only made it so that the the exception does not throw another exception (🤦🏼‍♂️) but we did not find yet the upstream cause.

Many people at the moment are having issues with firebase auth via phone:

@Yokoi-K
Copy link
Contributor Author

Yokoi-K commented Dec 21, 2022

@mariopepe

Sorry for the late reply.
I think you are right.

My PR fix is measure NullPointerException.
So I don't know what the essential issue of FirebaseAuthException is.

Thanks.

@firebase firebase locked and limited conversation to collaborators Jan 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants