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] Firebase Auth Web loses persistence after upgrading to the latest version #9089

Closed
jomiplaz opened this issue Jul 13, 2022 · 34 comments
Labels
impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) 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

@jomiplaz
Copy link

jomiplaz commented Jul 13, 2022

Bug report

Describe the bug
Firebase Auth Web loses persistence after upgrading to the latest version.

Steps to reproduce

  1. Login
  2. Refresh the page
@jomiplaz jomiplaz added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Jul 13, 2022
@darshankawar darshankawar added the triage Issue is currently being triaged. label Jul 13, 2022
@darshankawar
Copy link

@jomiplaz
Can you provide flutter doctor -v, plugin version and minimal code sample that shows the behavior you are seeing ?

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jul 13, 2022
@sgehrman
Copy link

sgehrman commented Jul 15, 2022

Same issue. Both of my web apps are broken.

@sgehrman
Copy link

This is a show-stopper. I can't release a new build until this is fixed.

$ flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on Debian GNU/Linux 11 (bullseye) 5.10.0-16-amd64, locale en_US.UTF-8)
• Flutter version 3.0.5 at /home/steve/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (31 hours ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc4)
• Android SDK at /home/steve/Android/Sdk
• Platform android-31, build-tools 31.0.0-rc4
• Java binary at: /home/steve/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.

[✓] Chrome - develop for the web
• Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
• Debian clang version 11.0.1-2
• cmake version 3.15.2
• ninja version 1.8.2
• pkg-config version 0.29.2

[✓] Android Studio (version 2021.2)
• Android Studio at /home/steve/android-studio
• Flutter plugin version 68.1.2
• Dart plugin version 212.5744
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.69.1)
• VS Code at /usr/share/code
• Flutter extension version 3.44.0

[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Debian GNU/Linux 11 (bullseye) 5.10.0-16-amd64
• Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.114

[✓] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!

@sgehrman
Copy link

sgehrman commented Jul 15, 2022

Nothing fancy in my code. I listen to the authStateChanges stream. I get null user on browser refresh. I can login, I see the user, then refresh and I get back null for user. All my packages are the latest, and latest flutter.

@fanchungchit
Copy link

fanchungchit commented Jul 15, 2022

Same issue found here.
I've tried to downgrade the package and created a new project.
Before:
firebase_core: ^1.19.2
firebase_auth: ^3.4.2
Now:
firebase_core: 1.19.0
firebase_auth: 3.4.0

The result is getting this error.
TypeError: Cannot read properties of undefined (reading 'auth')
Which only happened on web.

@cspyo
Copy link

cspyo commented Jul 15, 2022

I solved a issue similar to this, following steps.

  1. Delete your pubspec.lock file

  2. Edit pubspec.yaml to downgrade the packages

firebase_auth: 3.4.1
firebase_auth_platform_interface: 6.3.1
firebase_core: 1.19.1
firebase_core_web: 1.6.6
  1. Add this line in your main
if (kIsWeb) {
    await FirebaseAuth.instance.authStateChanges().first;
  }

You can get auth also after pressing a refresh button on Web.

@sgehrman
Copy link

I'm waiting for the update. Is this a high priority?

@darshankawar
Copy link

The root cause seems to be mentioned here: #9117 (comment)
A fix for this can be followed up here: #9138

@darshankawar darshankawar added plugin: auth platform: web Issues / PRs which are specifically for web. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. triage Issue is currently being triaged. labels Jul 19, 2022
@fballan93
Copy link

fballan93 commented Jul 19, 2022

My web app have the same issue after i updated to this latest version . im glade to see this reported . any ETA for the fix

@mrleesin
Copy link

Same issue

@woutervanwijk
Copy link

woutervanwijk commented Jul 21, 2022

Same here. I'm really amazed how bad QA apparently is that this bug is not catched in the process. It's a big one. And especially since this is apparently a problem in a point release with firebase_auth: 3.4.1 to 3.4.2. This should REALLY not happen!!!

@sgehrman
Copy link

Another good example of the more tests a code base has, the worse the quality. Coders spent too much time writing tests, and not enough time writing quality code. And they use the tests as an excuse for sloppiness as long as their tests pass. This bug is obvious. Should never have been released.

@mklepaczko
Copy link

Same here for web

@woutervanwijk
Copy link

Another good example of the more tests a code base has, the worse the quality. Coders spent too much time writing tests, and not enough time writing quality code. And they use the tests as an excuse for sloppiness as long as their tests pass. This bug is obvious. Should never have been released.

Fully agree, it's a mess. And it's not the first time

@cedvdb
Copy link

cedvdb commented Jul 22, 2022

Another good example of the more tests a code base has, the worse the quality. Coders spent too much time writing tests, and not enough time writing quality code. And they use the tests as an excuse for sloppiness as long as their tests pass. This bug is obvious. Should never have been released.

I cannot disagree more. Last time I checked, there was no integration test for phone authentication on the web, which did not inspire confidence.

How would this pass otherwise #9097 (comment) (phone auth not working at all) ?!

So the issue is: there are good, integration test missing. If the core public API isn't properly tested on every platform, this type of things will eventually happen on multi platform packages that are subject to multi platforms hickups.

Some integration tests are commented (I think it was the storage tests), some core feature like phone auth are just not tested or not tested on some platforms, or not fully tested.

As far I know flutterfire is backed up by google (I could be wrong here). A less rigid QA process for an open source project is understandable but for a project that has a commercial goal in mind, I find it unprofessional. So I hope this won't just slide once the issue is resolved because this is going to happen again in the future and then some more.

I did not say it was easy to do, but not testing core features on every platform should not fly either.. I hope some work will be done in that department

Note: to write phone auth integration tests, you can call a specific firebase emulator endpoint to get the verification code needed to do the proper testing. That endpoint is emulator/v1/projects/projectId-33333/verificationCodes

@organicinternet
Copy link

#9138 persists for me using these dependency_overrides:

  firebase_auth:
    git:
      url: https://github.com/firebase/flutterfire.git
      path: packages/firebase_auth/firebase_auth
      ref: "@russell/auth-9117"
  firebase_auth_platform_interface:
    git:
      url: https://github.com/firebase/flutterfire.git
      path: packages/firebase_auth/firebase_auth_platform_interface
      ref: "@russell/auth-9117"
  firebase_auth_web:
    git:
      url: https://github.com/firebase/flutterfire.git
      path: packages/firebase_auth/firebase_auth_web
      ref: "@russell/auth-9117"
  firebase_core_platform_interface:
    git:
      url: https://github.com/firebase/flutterfire.git
      path: packages/firebase_core/firebase_core_platform_interface
      ref: "@russell/auth-9117"

@darshankawar darshankawar added the impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) label Jul 25, 2022
@kaumudpa
Copy link

Same issue with firebase_auth 3.5.1!

@cosmicb0y
Copy link

Same issue

@bigbrain-cmd
Copy link

same issue, production is down because of it...

@stx
Copy link

stx commented Jul 26, 2022

Firebase is an amazing product, and Flutterfire is an amazing integration, and I think the bug is totally understandable - software will be software - but it feels very scary to me that this issue has been open for 2 weeks in a stable channel, and it received a stable production release anyway, and seemingly has received no response or fix (that I've seen, anyway - I could be wrong.)

I think teams (including ours) are looking for assurance of some kind. I realize this isn't fair to the maintainers, just trying to express how I think other development teams may feel. There is an incredible reliance on Firebase, and the Auth product in particular, in the Flutter industry, and it feels scary to have to deal with these issues on our own.

@darshankawar
Copy link

/cc @russellwheatley

@cedvdb
Copy link

cedvdb commented Jul 26, 2022

I think the bug is totally understandable - software will be software

That's why integration tests exist. Honestly this is bigger than a bug...

@LiangHuangBC
Copy link

Firebase is an amazing product, and Flutterfire is an amazing integration, and I think the bug is totally understandable - software will be software - but it feels very scary to me that this issue has been open for 2 weeks in a stable channel, and it received a stable production release anyway, and seemingly has received no response or fix (that I've seen, anyway - I could be wrong.)

I think teams (including ours) are looking for assurance of some kind. I realize this isn't fair to the maintainers, just trying to express how I think other development teams may feel. There is an incredible reliance on Firebase, and the Auth product in particular, in the Flutter industry, and it feels scary to have to deal with these issues on our own.

Agree, similar issue #9166 looks nobody really did test on all platform release.

@kekko7072
Copy link

  • 1

@KristofVDB1
Copy link

KristofVDB1 commented Jul 26, 2022

+1

@sgehrman
Copy link

I've literally been sitting here idle patiently waiting for two weeks now. Is this fixed yet? What is going on? I'm running a business and need to update my software. Revert back to the old build if you have too. I tried to revert back and couldn't get it working. Could someone just fix it and post a new build?

@darshankawar
Copy link

The team is actively working on fixing this #9138. Please subscribe to the PR for updates.

@russellwheatley
Copy link
Member

This fix has just been released in the latest version 3.6.0. Thanks.

@cruftmonger
Copy link

I upgraded to 3.6.0 but see the same problem. I updated my original issue with a new dependency list. The rest of the problem description remains the same. #9241 (comment)

@kaumudpa
Copy link

kaumudpa commented Jul 28, 2022

True.

There is another problem with the auth state in web since firebase_auth: 3.5.0 - If browser page is refresh/reloaded after the initial authentication of a user sends out unauthorised while trying to access firestore.

@kaumudpa
Copy link

Also check #9243

@cruftmonger
Copy link

This fix has just been released in the latest version 3.6.0. Thanks.

I still get the same problem with 3.6.0. Did you add a regression test for it? #9241

@AdamLBS
Copy link

AdamLBS commented Jul 28, 2022

On my side it has been fixed while upgrading to 3.6.0 whenever the page is refreshed I'm still logged in, current dependencies are :

firebase_core: ^1.20.0 firebase_auth: ^3.6.0 cloud_firestore: ^3.4.1

@RajendraAVerma
Copy link

After waiting for about 2 week, issue has been fixed. thanks ❤️.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) 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
Development

No branches or pull requests