Discourse broken after moving servers

Our Discourse instance has been hosted on Digital Ocean for many years, to the point where issues were cropping up due to still being on Ubuntu 18. So, I created a new Droplet with a fresh Discourse install, bootstrapped it, then downloaded and restored the latest backup from the old Droplet. No errors during any of this.

Once logged in to the new instance, though, it looks like this:

And the console gives me this:

Uncaught SyntaxError: unexpected token: private identifier
admin-13326e7ca61effcc233d500e3263c63074c9823b7e1d0c1680b6f68e23565d5a.js:76:99
ℹ️ Discourse v3.3.0.beta2-dev — https://github.com/discourse/discourse/commits/2a2eaf835f — Ember v5.5.0 app.js:213
Uncaught (in promise) Error: There is no route named admin
    handlersFor https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    isActiveForRoute https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    isActiveForState https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    get isActive https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    get class https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    Re https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    a https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    tag https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    track https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    d https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    Ke https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    tag https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    track https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    d https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    Je https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    flush https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    <anonymous> https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    evaluate https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    evaluateSyscall https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    evaluateInner https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    evaluateOuter https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    next https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    _execute https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    execute https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    sync https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    render https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    _renderRoots https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    Nt https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    _renderRoots https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    _renderRootsTransaction https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    _renderRoot https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    _appendDefinition https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    appendOutletView https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    invoke https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    flush https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    flush https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    _end https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
    _boundAutorunEnd https://discourse.gomomentum.org/assets/vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9
vendor.ff29780b9fed784cce2d843dcb93a803-608f4f77d8437d715d8d39c739c0c8bbe0fe51c9305e55f1ec7d0bee19f5571f.js:9:384138

Any suggestions on where to begin troubleshooting this would be much appreciated. Thanks!

1 Like

Can you try to visit your site in safe mode to see if it loads?

1 Like

I have done that. It looks identical, and I get the same errors.

Oh, also, I just tried logging into a different account without admin or moderator permissions, and it loads fine, as far as I can tell. I have access to three different types of accounts, and here are the results of my experimenting:

  • admin account → broken
  • moderator account (with limited access to the admin dashboard) → broken
  • regular account → works fine

The problem seems to happen only if the sidebar menu includes the “Admin” link, since that’s what would have appeared right below the “Review” item in the screenshot above. Maybe that helps?

Also, if it matters, the old instance that I took the backup from was not on the latest Discourse. I think it was on something like 3.1.2. The new instance, of course, is on latest.

The problem is that there is a syntax error in one the admin javascript file and that leads to the side effect of the admin route not being registered.

In the console, are you able to expand or access the file which the syntax error is thrown? The information is kind of limited right now for us to be able to tell what is wrong.

Sure, although it’s just one contiguous line of minified Javascript. I tried pasting the whole thing here, but it exceeds the allowed character count. I used an online unminify tool and identified the block of code throwing the error.

(P.prototype.handlersFor = function (e) {
    var t = this.names[e];
    if (!t) throw new Error("There is no route named " + e);
    for (var r = new Array(t.handlers.length), n = 0; n < t.handlers.length; n++) {
        var i = t.handlers[n];
        r[n] = i;
    }
    return r;
}),

Will this help, or do I need to find a way to post the entire file?

Are you using cloudflare with the orange cloud? If so, disable it.

2 Likes

I have a similar problem that seems to have started today or yesterday. My admin routes don’t work, and a menu is broken.

Uncaught (in promise) Error: There is no route named admin

I found this topic by searching to see if anyone else was encountering a problem with Cloudflare.

If I clear the Cloudflare cache or turn on development mode it goes away, but as soon as caching starts, the problem comes back.

Edit: I’m not sure if this is related, but these are some of the errors in the console when logged in as an admin.

Here’s the line of code:

class d extends t.default{static#e=dt7948.g(this.prototype,"currentUser",[a.service])#t=void dt7948.i(this,"currentUser")

My menu cuts off here:

image

The “no route named admin” error happens when I open that menu. It might be cutting off where the “admin” link would be.

You should disable all rules in Cloudflare, including Rocket Launcher and anything WAF.

If you keep your Cloudflare config clean, it does not cause any problems with Discourse.

Rocket Loader is off on this site. I don’t think any changes to Cloudflare settings have been made recently. (I just checked the audit logs.)

@Ryan_Hyer I’m looking at your screenshot again. Is it cutting off right where the admin menu item would appear? That’s the same place it’s happening on my site.

If you have things like WAF turned on, Cloudflare could also make changes to its inner behaviour that might affect your site.

Please also make sure that Cloudflare’s “auto minify” feature is disabled, and that you have purged the cache.

They’ve deprecated the feature because it does not work for modern JS features (which Discourse is now using)

1 Like

We have reverted the change due to the issues with Cloudflare and Safari 15.

So @Ryan_Hyer if you upgrade Discourse again, things should be back to normal.

(but still, I strongly recommend disabling all of Cloudflare’s JS “optimization” features like Rocket Loader and auto-minify)

3 Likes

Thank you! Git pull says I’m already up to date, so the change must not be available yet?

I believe the only thing we’re using Cloudflare for is DNS and DDOS protection, nothing else. But yes, we had the orange cloud on. I just turned it off, and my site seems to be unbroken, awesome! Thanks guys!

2 Likes

This orange cloud without any adjustments from defaults essentially means “break my site”.

We have a guide on what to configure if you’re using it.

1 Like

Thanks, that was it. I disabled auto-minifiy, cleared the cache, did a hard-refresh, and things worked again.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.