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

🐛 [firebase_auth] TypeError: Cannot read properties of undefined (reading 'appVerificationDisabledForTesting') #11485

Closed
jeprojects opened this issue Aug 17, 2023 · 26 comments · Fixed by #11514
Labels
platform: web Issues / PRs which are specifically for web. plugin: auth resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working

Comments

@jeprojects
Copy link

jeprojects commented Aug 17, 2023

Bug report

Describe the bug
When using verifyPhoneNumber() on web (tested working on iOS) an exception is thrown

[firebase_auth/unknown] An unknown error occurred: TypeError: Cannot read properties of undefined (reading 'appVerificationDisabledForTesting')

Steps to reproduce

Steps to reproduce the behavior:

  1. Call verifyPhoneNumber() as per normal

Expected behavior

It should send an SMS verification code to the entered phone number

Additional context

Started happening from flutter_auth 4.7.0


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.0, on macOS 12.6.6 21G646 darwin-x64, locale en-AU)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Community Edition (version 2022.1)
[✓] VS Code (version 1.80.1)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!


Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
- firebase_auth 4.7.3 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_auth_platform_interface 6.16.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 5.6.3 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser js meta]
- firebase_core_platform_interface 4.8.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.7.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_storage_platform_interface 4.4.5 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_storage_web 3.6.6 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta]


@jeprojects jeprojects added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Aug 17, 2023
@jeprojects jeprojects changed the title 🐛 [flutter_auth] TypeError: Cannot read properties of undefined (reading 'appVerificationDisabledForTesting') 🐛 [firebase_auth] TypeError: Cannot read properties of undefined (reading 'appVerificationDisabledForTesting') Aug 17, 2023
@drklrd56
Copy link

drklrd56 commented Aug 17, 2023

Facing the same issue on firebase_auth v4.7.3 when I call the verifyPhoneNo function on flutter web.

#0 packages/hidden/core/utils/logging.dart 53:53 error
#1 packages/hidden/core/utils/phone_authenticator/phone_authenticator.dart 38:13 verificationFailed

⛔ unknown -- An unknown error occurred: TypeError: Cannot read properties of undefined (reading 'appVerificationDisabledForTesting')

Verification Failed
An unknown error occurred: TypeError: Cannot read properties of undefined (reading 'appVerificationDisabledForTesting')

@danagbemava-nc danagbemava-nc added the triage Issue is currently being triaged. label Aug 17, 2023
@danagbemava-nc
Copy link

danagbemava-nc commented Aug 17, 2023

Hi @jeprojects, please provide the code sample you're using in a repo that we can clone so that we can investigate this.

Please note that for web, you should be using signInWithPhoneNumber instead of verifyPhoneNumber. See https://firebase.google.com/docs/auth/flutter/phone-auth#web_signinwithphonenumber

@danagbemava-nc danagbemava-nc added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Aug 17, 2023
@karen1au
Copy link

karen1au commented Aug 17, 2023

Facing the same issue, verifyPhoneNumber worked before v4.7.3. I've tried using signInWithPhoneNumber, it doesn't go past _delegate.signInWithPhoneNumber and does not exit signInWithPhoneNumber method <- this also happens on 4.7.2

@PROGrand
Copy link

Setting previous version in index.html solves signInWithPhoneNumber problem. (But not tested again other stuff)

<head>
 ...
    <script>window.flutterfire_web_sdk_version = '9.22.1';</script>
</head>

@lisovyk
Copy link

lisovyk commented Aug 17, 2023

Setting previous version in index.html solves signInWithPhoneNumber problem. (But not tested again other stuff)

<head>
 ...
    <script>window.flutterfire_web_sdk_version = '9.22.1';</script>
</head>

Fixes it for me on web project, firebase_auth 4.7.1

@OthmanShaker
Copy link

Fixes it for me on web project, firebase_auth 4.7.1

didnt for me , all i did was do flutter upgrade and even reverting now doesnt solve it anymore

@karen1au
Copy link

Setting previous version in index.html solves signInWithPhoneNumber problem. (But not tested again other stuff)

<head>
 ...
    <script>window.flutterfire_web_sdk_version = '9.22.1';</script>
</head>

This works on 4.7.3 as well but with a flutter warning... Which means something in the update is not compatible with the latest SDK 🤔

 WARNING: FlutterFire for Web is explicitly tested against Firebase JS SDK version "10.1.0"
            but your currently specifying "9.22.1" by either the imported Firebase JS SDKs in your web/index.html

@OthmanShaker
Copy link

Setting previous version in index.html solves signInWithPhoneNumber problem. (But not tested again other stuff)

<head>
 ...
    <script>window.flutterfire_web_sdk_version = '9.22.1';</script>
</head>

This works on 4.7.3 as well but with a flutter warning... Which means something in the update is not compatible with the latest SDK 🤔

 WARNING: FlutterFire for Web is explicitly tested against Firebase JS SDK version "10.1.0"
            but your currently specifying "9.22.1" by either the imported Firebase JS SDKs in your web/index.html

this worked for me aswell , with the same warnning

@jeprojects
Copy link
Author

jeprojects commented Aug 18, 2023

Setting previous version in index.html solves signInWithPhoneNumber problem. (But not tested again other stuff)

<head>
 ...
    <script>window.flutterfire_web_sdk_version = '9.22.1';</script>
</head>

It fixes it for me with verifyPhoneNumber() on the web. I will still move the web build over to signInWithPhoneNumber though.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Aug 18, 2023
@NefariousNiru
Copy link

<script>window.flutterfire_web_sdk_version = '9.22.1';</script>

Works withsignInWithPhoneNumber() on Web for me. However like everyone else I still get a warning.

WARNING: FlutterFire for Web is explicitly tested against Firebase JS SDK version "10.1.0"
but your currently specifying "9.22.1" by either the imported Firebase JS SDKs in your web/index.html
file or by providing an override - this may lead to unexpected issues in your application. It is recommended that you change all of the versions of the
Firebase JS SDK version "10.1.0":
If you override the version manually:
change:
<script>window.flutterfire_web_sdk_version = '9.22.1';</script>
to:
<script>window.flutterfire_web_sdk_version = '10.1.0';</script>
If you import the Firebase scripts in index.html, instead allow FlutterFire to manage this for you by removing
any Firebase scripts in your web/index.html file:
e.g. remove: <script src="https://www.gstatic.com/firebasejs/9.22.1/firebase-app.js"></script>

@davidmigloz
Copy link

9.23.0 is the latest version 9.x version. It also seems to work.

@danagbemava-nc
Copy link

Is anyone facing this issue when they use signInWithPhoneNumber ?

@danagbemava-nc danagbemava-nc added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Aug 18, 2023
@davidmigloz
Copy link

I believe it affects both:

  • Phone authentication
  • Or phone as a second factor

@jeprojects
Copy link
Author

@danagbemava-nc by the looks of the comments, most of them.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Aug 18, 2023
@anthonyhunter
Copy link

anthonyhunter commented Aug 20, 2023

Same here

I suspect this because of https://github.com/firebase/firebase-js-sdk/pull/7326/files

The parameters to RecaptchaVerifier() were reordered in SDK but corresponding change not yet made in FlutterFire.

@danagbemava-nc
Copy link

Thanks all for your patience, I can reproduce the issue using the plugin example code.

cc @russellwheatley

@danagbemava-nc danagbemava-nc removed the Needs Attention This issue needs maintainer attention. label Aug 21, 2023
@shobith
Copy link
Contributor

shobith commented Aug 23, 2023

Hope someone can guide that PR to a quick resolution, I need this fix :(

@IncognitoGK9
Copy link

This issue is pending. Even after adding:
<script>window.flutterfire_web_sdk_version = '9.22.1';</script> or the 9.23.0 as suggested by @davidmigloz,

  1. You get the warning below:

` WARNING: FlutterFire for Web is explicitly tested against Firebase JS SDK version "10.1.0"
but your currently specifying "9.23.0" by either the imported Firebase JS SDKs in your web/index.html
file or by providing an override - this may lead to unexpected issues in your application. It is
recommended that you change all of the versions of the
Firebase JS SDK version "10.1.0":

        If you override the version manually:
          change:
            <script>window.flutterfire_web_sdk_version = '9.23.0';</script>
          to:
            <script>window.flutterfire_web_sdk_version = '10.1.0';</script>

        If you import the Firebase scripts in index.html, instead allow FlutterFire to manage this for you by    
        removing
        any Firebase scripts in your web/index.html file:
            e.g. remove: <script src="https://www.gstatic.com/firebasejs/9.23.0/firebase-app.js"></script> `

for which you find the script was added manually as advised
2. The web sms authentication (when using Firebase Emulators now completely does not send the generated 6 character OTP code.

One major thing to note: This started failing immediately after upgrading from Flutter 3.10.6 to Flutter 3.13.0>

Note that the packages are all up to the latest.

This issue should remain open. I have checked on the rearranged RecapchaVerifier but I do not see how the rearranging will force a warnig to change flutter web sdk from 19. I did even try the latest SDK, the error persisit.
I could see a new Flutter 3.13.1 which addresses another issue (132711). I had also experienced but it is not addressing this particular issue (the fixes above may be working with JavaScript, but not with Flutter projects.

@rahmanrezaee
Copy link

Same issue with 10.1.0
is any solution??

@dannycortesv
Copy link

This doesn't work for me with latest firebase_auth version, it works with these ones:

firebase_auth: 4.6.3
firebase_auth_web: 5.5.3
firebase_auth_platform_interface: 6.15.3

and using <script>window.flutterfire_web_sdk_version = '9.23.0';</script> before closing head

@prologikus
Copy link

this issue is still present [3.13.1]

@danagbemava-nc danagbemava-nc added the resolution: fixed A fix has been merged or is pending merge from a PR. label Aug 30, 2023
@IncognitoGK9
Copy link

I have tested with flutter sdk 3.10.6 and 3.13.0 and 3.13.2 and come to a conclusion, the issue is with: firebase_auth: ^4.7.0 and above.
While they have merged some changes to that effect with firebase_auth: ^4.9.0, and with respect to this: [https://github.com//pull/11514], The two are not on the same page: so I have manually used: firebase_auth: ^4.6.3 for my SMS authentication to again work in the local firebase emulator.

@lisovyk
Copy link

lisovyk commented Sep 1, 2023

The issue is fixed for me on:
firebase_auth: ^4.9.0
Flutter 3.13.0

Don't forget to comment out the fix in index.html if you made it.

@hiteshdotcom
Copy link

I am getting the same issue on signInWithPhoneNumber, using Firebase 10.3.1
Did anyone get any solution for the web?

@hiteshdotcom
Copy link

I am getting the same issue on signInWithPhoneNumber, using Firebase 10.3.1 Did anyone get any solution for the web?

I resolved this issue by degrading the firebase version to 9.14.0 Hope this helps you out

@anthonyhunter
Copy link

Fixed for me on Android, iOS and web
flutter: "3.13.3"
firebase_auth: "4.9.0"

@firebase firebase locked and limited conversation to collaborators Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: web Issues / PRs which are specifically for web. plugin: auth resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working
Projects
None yet