Users are experiencing a Handlebars is not defined error in Discourse 2.9.0.beta2, particularly with custom themes and plugins. HisashiQ reports the issue occurs with an above-site-header.hbs connector, while cookieman768 identifies the problem in a theme component related to tag icons. amotl resolves it by deactivating the discourse-knowledge-base plugin. HisashiQ fixes it by explicitly installing and requiring Handlebars in a custom plugin, though david questions this approach, suggesting the issue is likely related to JavaScript load order rather than dependencies. merefield and sam advise checking theme components and JavaScript code for outdated or incompatible references.
We have two discourse apps. I upgraded both to 2.9.0beta2. The first went without a hitch but the second threw a console error saying Uncaught ReferenceError: Handlebars is not defined
The only difference between the two apps is they use different custom themes. It seems that the one that broke has an above-site-header.hbs connector and the other does not. It seems that the js error was pointing to the above-site-header.hbs file. Is it possible this is loading in before handlebars is loading in for 2.9.0beta2. I went back to the stable version (2.8.1) and it works fine for both applications. Any ideas?
If you could share the url for the broken theme and/or the broken site, people would have a better chance of seeing what’s wrong. (Or perhaps both are secret and/or password protected.)
I’m afraid that the site and theme are both private. The site is also fixed now. Changing the version in app.yml to stable rather than keeping the default of tests-passed does it so it does imply that this beta version is the issue. The file that throws the error is found at:
connectors/above-site-header/jc-header.hbs (I incorrectly noted it was in above-site-header.hbs in the title. My fault)
Happy to run some checks if that helps but can’t share the site or theme I’m afraid!
Well in that case I’d suggest you make a copy of the theme and delete things in small steps until the error is gone. Then the error was caused by the last thing you removed.
If you can post some code from the jc-header.hbs file, that would be useful. Hopefully all that is needed is a small compatibility update to your theme.
Hi there, I have also a problem with the latest version and the header menu bar plugin.
Guess I´ll have to roll back to 2.9.0beta1
Could you quickly tell me please how to do this?
A
Which Git revision should this container use? (default: tests-passed)
#version: tests-passed
version: ‘v2.9.0.beta1’
leads to
I, [2022-02-24T09:38:37.878937 #1] INFO – : > cd /var/www/discourse && git checkout v2.9.0.beta1
error: pathspec ‘v2.9.0.beta1’ did not match any file(s) known to git
Hello! I just started having this issue too! My site is public, so if you want to take a look it is here: https://forum.simplecraft.us - I’ll provide a list of the plugins I’m using, but there’s not that much customization except for I’m using the Air Theme with some custom CSS.
Everything seems to work for me until I click on a post such as the newest one in announcements.
For anyone struggling with this, we had a custom plugin that used to work and can no longer can find handlebars. We did a yarn install of handlebars and explicitly required it in the plugin and it’s back to working. Not sure why we now need to explicitly require it and previously we didn’t but that solved it for me.
@HisashiQ can you share the code for the custom plugin? You certainly shouldn’t need to install handlebars manually. The problems in the topic above were related to JS load order, not yarn dependencies.