Handlebars Error for 2.9.0.beta2 with above-site-header.hbs connector

Hi,

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?

1 Like

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!

Kind Regards,
Quinn Koike

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.

1 Like

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

Thanks!

Not in the office now but will post that here when I get back to my machine.

Sounds like your import of the Handlebars object is just out of date or missing.

2 Likes

Hi there,

FWIW, on another private instance of Discourse we are running, after upgrading to 2.9.0.beta2, we also observed this error on the browser console.

This also rendered the functionality of the DiscoTOC theme component completely defunct.

After deactivating the outdated discourse-knowledge-base plugin, the system started behaving properly again, with no errors on the browser console.

With kind regards,
Andreas.

5 Likes

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.

Plugins List
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-saml.git
          - git clone https://github.com/discourse/discourse-whos-online.git
          - git clone https://github.com/discourse/discourse-adplugin.git
          - git clone https://github.com/discourse/discourse-reactions.git
          - git clone https://github.com/discourse/discourse-automation.git
          - git clone https://github.com/discourse/discourse-user-notes.git
          - git clone https://github.com/discourse/discourse-sitemap.git
          - git clone https://github.com/discourse/discourse-fingerprint.git
          - git clone https://github.com/discourse/discourse-perspective-api.git
          - git clone https://github.com/discourse/discourse-voting.git
          - git clone https://github.com/discourse/discourse-subscriptions.git
          - git clone https://github.com/Simple-Craft/discourse-steam-login.git
          - git clone https://github.com/discourse/discourse-algolia.git
          - git clone https://github.com/discourse/discourse-chat-integration.git
          - git clone https://github.com/discourse/discourse-category-experts.git
          - git clone https://github.com/communiteq/discourse-private-replies.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-data-explorer.git
          - git clone https://github.com/discourse/discourse-oauth2-basic.git
          - git clone https://github.com/discourse/discourse-jwt.git

It is something in your theme javascript cause all works fine with:

Recommend disabling all theme components and slowly enabling them to figure out is at fault.

2 Likes

Thank you so much for that! It looks like my tag icons theme component just wasn’t set to auto update for some reason, updating that fixed everything!

3 Likes

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.

2 Likes