Registration modal/popup not showing up for private instance

Hi!

Somewhere while upgrading from 2.4.0.beta1 to 2.4.0.beta2 to 2.4.0.beta4 (not sure on which upgrade exactly) the registration modal stopped showing up for new users.

We use the OpenID Connect plugin to authenticate our users. Login is required, local logins are disabled and new registrations are allowed. Disabling the login requirement or enabling local logins “resolves” the issue and users may register again. Local logins should, however, stay disabled and we want logins to be required as well.
The OIDC Log is normal and shows a Fetched userinfo response with the new user’s credentials although no modal shows up. I tried moving to a fresh install and restoring the backup, but the issue persists. Without restoring my backup, the modal shows up, so there’s something with my backup that makes this issue appear :confused:

Our current Discourse version is 2.4.0.beta6, where the issue is present as well.

Do you have any theme components installed on the site? Does the issue persist in safe mode?

3 Likes

Fantastic, you were right! Removing the Knowledge Base component from the theme made the modal appear again! I obviously installed the component between one of those upgrades.

Strange enough, this is only true after I restore the backup, a clean install shows no such issue with the component enabled. I will just disable it, we weren’t using it anyways.

Thanks for helping out!

1 Like

That’s really peculiar. Do you recall seeing any particular errors with that component, such as in the browser developer console?

Indeed, under https://<HOST>/logs, I read the following: Uncaught TypeError: Cannot read property 'knowledge-base' of undefined

Additionally, there’s 8 times a TypeError: E.idMap(...) is undefined, but with no mentioning of the Knowledge Base component. It has the following backtrace (Url: https://<HOST>/assets/application-301651b1c7400a000974a9cecafd44ad3304cf647cf17bcfa7af68e9ed1ac4b7.js, Line: 9, Column: 20924, Window Location: https://<HOST>/login):

findById@https://<HOST>/assets/application-301651b1c7400a000974a9cecafd44ad3304cf647cf17bcfa7af68e9ed1ac4b7.js:9:20924
findByIds/<@https://<HOST>/assets/application-301651b1c7400a000974a9cecafd44ad3304cf647cf17bcfa7af68e9ed1ac4b7.js:9:21063
findByIds@https://<HOST>/assets/application-301651b1c7400a000974a9cecafd44ad3304cf647cf17bcfa7af68e9ed1ac4b7.js:9:21035
initialize/</<@https://<HOST>/theme-javascripts/ce296772003fb6162b99b62bf564066966940cc8.js?__ws=<HOST>:103:48
value/<@https://<HOST>/assets/application-301651b1c7400a000974a9cecafd44ad3304cf647cf17bcfa7af68e9ed1ac4b7.js:14:5447
C@https://<HOST>/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:6:19799
trigger@https://<HOST>/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:9:20668
s/</<@https://<HOST>/assets/application-301651b1c7400a000974a9cecafd44ad3304cf647cf17bcfa7af68e9ed1ac4b7.js:13:31963
y</t.invoke@https://<HOST>/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:16:9739
y</t.flush@https://<HOST>/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:16:8732
b</t.flush@https://<HOST>/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:16:10782
H</n._end@https://<HOST>/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:16:15440
H</n.end@https://<HOST>/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:16:12110
H</n._runExpiredTimers@https://<HOST>/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:16:16800
1 Like

I have some thoughts on what might be causing it.

I’m curious, though – did you have any categories listed in the kb categories theme setting while it was enabled? I can see a case in the code where it may cause an issue if there are no categories selected.

EDIT: I’ve pushed a fix that I think might handle the issue.

2 Likes

Indeed, I had no categories listed. But the modal does not display even after choosing one.
Maybe related, but maybe something totally different: The default to kb view setting has no effect while the category is being displayed, and I have to click on the KB button and the Latest button back and forth to enable the KB view.

edit: I updated the component and it behaves now as follows: With an empty category listing, the modal does show up :tada:. Once I choose a category, however, the modal does not show up anymore.

Are you seeing those same errors in logs?

What’s happening here is there’s a route getting triggered that’s trying to look for the knowledge base component before it’s loaded.

Yeah, but they don’t stack anymore, but differ in the fourth line of their backtrace. The other lines look as above.

initialize/</<@https://<HOST>/theme-javascripts/<VARIES>.js?__ws=<HOST>:103:48

I added another commit with some additional checks to stop trying to query uninitialized items.

https://github.com/discourse/discourse-knowledge-base-theme/commit/e0d7813e9f4b9c6031de6eb5a062ed4434a83069

No difference, TypeErrors keep coming up.

I was able to fix those particular error messages in this commit. Not sure if it fixes the modal issue, but it seems related.

https://github.com/discourse/discourse-knowledge-base-theme/commit/04ff864caf6823d37cb3cb1c153e0b7ed392fd3d

1 Like

Looks good to me, the modal now shows up even with categories selected! :confetti_ball:

2 Likes