firebase / firebaseui-web

FirebaseUI is an open-source JavaScript library for Web that provides simple, customizable UI bindings on top of Firebase SDKs to eliminate boilerplate code and promote best practices.
https://firebase.google.com/
Apache License 2.0
4.58k stars 1.06k forks source link

Error: INTERNAL ASSERTION FAILED: Pending promise was never set #947

Open jonathon-love opened 2 years ago

jonathon-love commented 2 years ago

[REQUIRED] Describe your environment

[REQUIRED] Describe the problem

when using the web demo (the demo from this repo), logging in using the microsoft login provider does not complete correctly. the signInSuccessWithAuthResult() callback is never called. instead an error is thrown:

Error: INTERNAL ASSERTION FAILED: Pending promise was never set

Screen Shot 2022-04-06 at 14 33 06

jonathon-love commented 2 years ago

here's the problem occuring with the project's online demo:

https://youtu.be/sK7IctXsDC4

in the firebaseui demo, onAuthEvent() is never called. however, if you run the firebase quickstart microsoft demo, that same error is thrown, however the onAuthEvent() is called. see here:

https://youtu.be/pRidN38YQps

i'll add that the firebaseui-web sometimes does work ... often the first time i interact with it, it "just works", but in any sort of log back out, open a private window, try again, testing dev workflow ... it stops working. you see this in the js quickstart demo ... the first time i try it, it works, but the second time it fails. this error is more common in firefox too ... i still do get it to happen in chrome though.

lisajian commented 2 years ago

Hi, thanks for filing this issue! We are unable to promise any timeline for this, but if others also have this issue, adding a +1 on this issue can help us prioritize adding this to the roadmap.

(Googler-only internal tracking bug: b/228618898)

ArturVRSampaio commented 2 years ago

+1

dropmann commented 2 years ago

+1

jonathon-love commented 2 years ago

hi,

i think it's important for the firebaseui project to be more upfront about this limitation ... that the microsoft login only works intermittently ... i think many people will see the promise of firebaseui -- a project that allows easy log in to all providers -- as compelling, invest the hours into incorporating it into their project, only to find that it doesn't live up to that promise.

the caveat that it doesn't really work with microsoft log in needs to be front and center in the documentation, along with communicating that addressing this short-coming isn't really a priority:

We are unable to promise any timeline for this

we would never have spent the time incorporating firebaseui had we understood this limitation.

jamesdaniels commented 2 years ago

FWIW I'm not able to reproduce in Chrome v100, MacOS. What flavor of microsoft accounts are you experiencing this with?

jonathon-love commented 2 years ago

i just reproduced (first attempt) using one of those @outlook.com accounts ... i think it's more common in ff than chrome, but i've definitely seen it in chrome.

Sydney-o9 commented 2 years ago

+1. This happens for me in Firefox - login with Facebook.

MuhammadM1998 commented 2 years ago

+1 in Firefox

aizaiz commented 2 years ago

+1 in chrome mobile version 101.0.4951

9jaGuy commented 2 years ago

+1

gopak commented 2 years ago

+1

vinaya-kloudle commented 2 years ago

+1

Gamewise commented 2 years ago

+1

Gamewise commented 2 years ago

It would be great if this could be fixed or the limitation made clearer in the documentation

michi88 commented 2 years ago

+1

crazould commented 2 years ago

+1

johanrd commented 2 years ago

+1

AdrianC47 commented 2 years ago

+1

Ayodelearog commented 2 years ago

I had this problem on FireFox with the sign in with Google as well.

0xindiebruh commented 1 year ago

+1 in chrome mobile version 99.0.4844

lukasvan3l commented 1 year ago

+1 on Android 13, Chrome Mobile 106.0.5249.126

jordankkk commented 1 year ago

+1

ismaelprzc commented 1 year ago

+1

pbilka46 commented 1 year ago

+1

trwinowiecki commented 1 year ago

+1

Running Chrome v107.0.5304.110 on LinuxMint 10.3

Happened once trying to login via Google Login, using custom firebase login (not firebaseui package). Works fine on Windows machine

andirsun commented 1 year ago

Same problem on Chrome 108.0.0 Mac os 10.15.7

vdegenne commented 1 year ago

I have this problem with SignInWithPopup (Firebase Web SDK v9). The popup pops and 3s later it closes with this error message:

Uncaught (in promise) FirebaseError: Firebase: Error (auth/popup-closed-by-user).

then about 8s later on this error message shows in the console:

@firebase/auth: Auth (9.15.0): INTERNAL ASSERTION FAILED: Pending promise was never set

What's weird is that the Sign in seems to work as I am able to catch the user information in the onAuthStateChanged listener. But is not persisted between refreshes.

jonduttweiler commented 1 year ago

I have this problem with SignInWithPopup (Firebase Web SDK v9). The popup pops and 3s later it closes with this error message:

Uncaught (in promise) FirebaseError: Firebase: Error (auth/popup-closed-by-user).

then about 8s later on this error message shows in the console:

@firebase/auth: Auth (9.15.0): INTERNAL ASSERTION FAILED: Pending promise was never set

What's weird is that the Sign in seems to work as I am able to catch the user information in the onAuthStateChanged listener. But is not persisted between refreshes.

I had a similar problem, and it was because I was using the ip 127.0.0.1 and it did not belong to an authorized domain. I changed to localhost and it worked again. You can go to the firebase configuration, and check the authorized domains. Hope this can help you

mikku489 commented 1 year ago

Any updates on this? seeing same error on Google login running on Firefox Really hoping I don't have spend time undoing all the Firebase integration...

My use started happening similar to Jonathon's where I cleared the cache data on signout.

jonathon-love commented 1 year ago

i'll outline the steps we used to workaround the issue.

  1. don't include microsoft.com in the providers passed to authUI.start()
  2. add your own microsoft.com button and wire-up your own MS login process, i.e.
        uiShown(): void {
            let emailProvider = document.querySelector('.firebaseui-id-idp-button[data-provider-id="password"]')?.parentElement;
            // insert the microsoft button after the email button
            emailProvider?.insertAdjacentHTML('afterend', '<li class="firebaseui-list-item"><button class="firebaseui-idp-button mdl-button mdl-js-button mdl-button--raised firebaseui-idp-generic firebaseui-id-idp-button" data-provider-id="microsoft.com" style="background-color:#2F2F2F" data-upgraded=",MaterialButton"><span class="firebaseui-idp-icon-wrapper"><img class="firebaseui-idp-icon" alt="" src="https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth/microsoft.svg"></span><span class="firebaseui-idp-text firebaseui-idp-text-long">Sign in with Microsoft</span><span class="firebaseui-idp-text firebaseui-idp-text-short">Microsoft</span></button></li>');

            // get the microsoft.com button
            let msProvider = document.querySelector('.firebaseui-id-idp-button[data-provider-id="microsoft.com"]');
            msProvider?.addEventListener('click', async (event) => {

                // use the msal library to get a microsoft id token
                msalInstance.setActiveAccount(null);
                const login = await msalInstance.loginPopup({ scopes: [ 'email' ], redirectUri: window.location.origin });

                // send it to an end point which takes the ms token, verifies it, then returns a firebase token
                let response = await fetch(`/token?msIdToken=${ login.idToken }`);
                let tokenData = await response.json();
                // sign in with the firebase custom token
                await auth.signInWithCustomToken(tokenData.token);
            });
        },

unfortunately, the /token endpoint you have to implement on the server side ... booo.

it's a bit of a pain, but we've been using the solution for about 6 months now, and it works well. i don't know what everyone else is doing ...

seems weird that such a crucial piece of functionality is broken in firebaseui ...

rkMylang commented 1 year ago

Hi, thanks for filing this issue! We are unable to promise any timeline for this, but if others also have this issue, adding a +1 on this issue can help us prioritize adding this to the roadmap.

(Googler-only internal tracking bug: b/228618898)

+1

AdrianC47 commented 1 year ago

+1

sjaindl commented 1 year ago

+1

traitran44 commented 1 year ago

+1 This feature is really crucial for us...

mgrahamjo commented 1 year ago

+1 (mobile Safari)

tyru commented 1 year ago

+1

umoh1 commented 12 months ago

+1

enesien commented 11 months ago

+1

RORO-ML commented 11 months ago

+1

zoltan-mihalyi commented 6 months ago

+1

mirshko commented 4 months ago

+1

shawnabramson commented 4 months ago

+1

loose-art commented 3 months ago

+1 (Mobile Safari 17.5)

eshalev commented 3 months ago

I have a unique corner case, where this happens in latest version of Chrome. If I first login, but then go back to my signin page, then this can be recreated consistently. By monitoring the console logs, I observed that if as soon as a page loads, I sign in with a Google provider using signInWithPopup then I get this " @firebase/auth: Auth (10.12.2): INTERNAL ASSERTION FAILED: Pending promise was never set"
Here's why it's happening for me. I invoke sign-out when the sign-in page first loads, but if the sign-out call has not completed, and the user signs in again before that, then the message above appears. You have to wait for the callback from sign-out to finish before signing in again. Unfortunately, the sign-out is taking as much as 30 seconds to complete. It's not an ideal UX. However, Once sign-out does complete, and then I sign-in again, then it works correctly.