Runtime error login bug

AI-generated summary

A runtime error preventing login via email/password occurs in Firefox (including Tor), throwing “PublicKeyCredential is not defined” during passkey-related operations. The issue affects invite-only, login-only setups and was confirmed by joerogan and Arkshine. pmusaraj identified the root cause: inconsistent browser support for isConditionalMediationAvailable(), especially in Firefox where the API is entirely unsupported. A fix was developed and merged via PR #24142 pmusaraj, requiring a full rebuild to apply, as local edits to source files won’t trigger asset recompilation pmusaraj. joerogan confirmed the fix didn’t work after container restart alone. The fix is now live in tests-passed and deployed to meta.discourse.org pmusaraj. Users are advised to rebuild their instance after the commit appears in tests-passed. Rafael_Melo_Silva reported the same error on Android, prompting pmusaraj to ask for browser version details to verify if the fix resolves mobile cases too. Temporary workaround: use one-time session links via email.

Login (local login with email and password) is not responding because of the following runtime error:

**publickeycredential is not defined.**
passkeyConditionalLogin
installModifier
install
untrack
install

Everytime you click the login button that appears in the console.

Env: invite only, login only system. Trying to login as admin. THe only I can get in is with email containing a one time session link.

Thanks for the report, I will take a look. Which browser (or browsers) is this happening on, do you know?

1 Like

firefox (Tor). I will thank you so much if you can fix it!
the setup again for reproducing: registered users only and invite only.

I can see an error as well in Firefox (not Chrome):

1 Like

I thought I was going crazy! For me it was PublicKeyCredential is not defined. Are you also invite and login only?

Any updates? its pretty disastrous for me

A fix is going to be merged soon :+1:

https://github.com/discourse/discourse/pull/24142

2 Likes

damn! thank you both and all who are fixing this. So then I run rebuild and it should be good , yeah? Or discourse-setup pulls from the repo too? Also I believe there is an error with the default onion template: the onion links redirects to the clearnet page and I have to run the doctor script becuase of some errors. I dont think it makes sense to manually turn off the redirect in nginx, since the rest of requests will still go through clearnet right?

THANKS FOR THE COMMIT. When is it gonna be merged usually?

Can I technically add those couple lines myself so I dont add more down time with rebuilding? Where is that app directory? And would launcher restart be enough?

It’s coming, it’s coming. I just pushed a modification to the fix, it’s tricky because the passkeys’ conditional UI is unevenly supported by browsers.

There is an API to check if the feature is supported, described here: PublicKeyCredential: isConditionalMediationAvailable() static method - Web APIs | MDN, but the call to isConditionalMediationAvailable() behaves differently on different browsers.

In Firefox. it is completely unsupported. In Safari on iOS, the feature is supported, but calling isConditionalMediationAvailable() returns false… so I had to modify the code to add a feature check just for Firefox.

Once tests pass, I will merge the change, it should be then available in about an hour.

3 Likes

thank yeah I saw the second commits… I am changing things locally so I wont rebuild right now and just restart container. It will work yeah? Did you just locally manually?

I just added the changes and restarted the container, but it still does not work. I still get the Publickeycredentials is not defined error.

I just merged the PR, once it’s in tests-passed, you can rebuild and it should fix the issue. I was testing locally with TOR and Firefox on macOS.

Keep an eye on GitHub - discourse/discourse at tests-passed · GitHub, once the commit shows up there, you can rebuild.

2 Likes

Do I have to rebuild? why is not working when I locally edit the files and run launcher restart? Because I just did exactly that

Because the changes you’re making are on the source files, you need to rebuild the assets.

How long will take to this update be official? My android app it’s showing that error

The fix is now merged, and I see it is deployed to meta.discourse.org, can you reproduce the issue here on your Android device? If so, please share browser version, thanks.

1 Like