Uncaught ReferenceError: Discourse is not defined due to Cloudflare Rocket Loader

On some topics on my site, when i open them on mobile device, i get these errors in JS console,

E.g when i open this on mobile FAQs For New Content Writers. Please Read If You Are A New Writer & Want To Join Howtodiscuss! - How To Discuss

Same error if i try to go to a topic directly by adding its ID and not topic name slug

https://howtodiscuss.com/t/14821

Same error if i open this topic on desktop:

I have just recently updgraded Discourse and also did manual rebuild from terminal, still this error is not going away. Can anyone help me solve this?

Are there any plugins which are causing this? these are my plugins currently:

All my plugins are upto date

Also, jsut tested and confirmed it does not happen if i goto my site and search for this topic “FAQ” and click on it, but if i directly copy the URL of this topic and open it directly in browser or click on a link (on some other external site, not on discourse, then this error comes).

Here are the RAW error log:

CodePile | Easily Share Piles of Code

1 Like

You are using Cloudflare Rocket Loader, which is unsupported.

Please go to the DNS entry for Discourse in your Cloudflare admin panel and make the cloud gray. Discourse will randomly fail with an orange cloud, as you can see.

3 Likes

@Falco many thanks for your quick response, i have just turned this Cloud to gray, means i have set it to DNS only, before it was proxied.

but i still see same error, i think i should turn off rocket loader in CF settings as well ,

i have turned off rocket loader in settings too

but as i refreshed that URL, i still see same errors :frowning:

It takes a few hours for the change to take place in my experience.

1 Like

Okay lets see, so you suggest me to keep that cloud gray and keep rocket loader off from settings aswell?

Also, i noticed many times randomly my site UI breaks up like this and i see this error in console

NetworkFirst.mjs:167 Uncaught (in promise) no-response: no-response :: [{"url":"https://pagead2.googlesyndication.com/pagead/gen_204?id=puberror&context=165&msg=TagError%3A%20adsbygoogle.push()%20error%3A%20No%20slot%20size%20for%20availableWidth%3D0%0Aat%20Vj%20(https%3A%2F%2Fpagead2.googlesyndication.com%2Fpagead%2Fjs%2Fadsbygoogle.js%3A155%3A453)%0Aat%20Uj%20(adsbygoogle.js%3A154%3A137)%0Aat%20ik%20(adsbygoogle.js%3A162%3A239)%0Aat%20Pk%20(adsbygoogle.js%3A191%3A493)%0Aat%20sl%20(adsbygoogle.js%3A209%3A106)%0Aat%20rl%20(adsbygoogle.js%3A207%3A1123)%0Aat%20Cl%20(adsbygoogle.js%3A222%3A288)%0Aat%20adsbygoogle.js%3A217%3A43%0Aat%20Ce.n.ba%20(adsbygoogle.js%3A68%3A294)%0Aat%20Qe%20(adsbygoogle.js%3A77%3A357)&shv=r20200924&eid=42530672%2C21067492&client=ca-pub-7087907313091932&slotname=5744927958&url=https%3A%2F%2Fhowtodiscuss.com%2Flatest"}]
    at a.makeRequest (https://howtodiscuss.com/javascripts/workbox/workbox-strategies.prod.js:1:2145)

Even if i disable or enable adblocker, this error does not go away.

That topic was working fine now, but

Also, i m now getting the unsecured error

I have turned the cloud back to proxied and have turn off rocket loader in settings, lets see.

The orange cloud means you didn’t get a certificate for your site during install, which is installed by default for everyone else.

Please read and follow Setting up HTTPS support with Let's Encrypt to fix it.

2 Likes

Okay, but i changed it to orange cloud proxied and turned off rocket loader from settings, it seems to be working fine now, thanks!

Also, can you advise me if you have Nginx experience and how can i do redirect with a query param Nginx VirtualHost, How to redirect a Discourse URL with ?AMP query parameter to a PHP file? - Stack Overflow