Cloudflare or plugins breaking my Discourse instance?

On my discourse forum, when I click on the bell icon for notifications, it keeps displaying the loader. In the loader menu it says, Slow down, too Many Requests from this IP Address. I’m using Cloudflare.

2 Likes

How are you using Cloudflare, specifically?

Here is a very relevant topic:

Have you followed the three steps given there?

1 Like

Yes, I have and it was working fine until the recent beta update.
And it works fine for the most part as well. Just notifications are causing issues, it makes infinite number of requests, every few seconds.

And here is my console

And here’s the file opened

2 Likes

Disable cloudflare, it is breaking your site.

2 Likes

I’m on the free plan of Cloudflare and using Cloudflare SSL of 5$ subscription and there’s no feature of Cloudflare which is enabled, ie. rocket loader is off and every other optimization eg. minification, etc is turned off and other features are not even available on free plan eg. railgun, etc. And caching is set to respect existing origin headers. And it was working fine, I have just realized that I have upgraded to master git branch by going to /admin/upgrade that may have screwed things up. I have later removed the scripts and the mentions but it’s still repeatedly checking for notifications. And it’s only the notifications which cause the issue, everything else works.

I’m using Cloudflare to serve my files stored in amazon s3 through CloudFront, If I don’t use Cloudflare, my costs will go up. Cloudflare is only serving as DNS and SSL provider, its optimizations & features (most of them) are turned off and many are not even available on the free plan. Do you think in my scenario, Cloudflare is still a culprit?

Should I try rebuilding to resolve the issues?

P.S.: I’m a fan of StackOverflow, CodingHorror Blog, and discourse. Regards :vulcan_salute:

1 Like

Try disabling CloudFlare (excepting basic DNS) as an experiment first. If the problem goes away that tells you something.

1 Like

I had disabled cloudflare orange cloud, waited for browser to show letsencrypt ssl instead of cloudflare to verify that content is accessed directly from server and not through cloudflare and then rebuild and now visiting clicking on user menu and notification icon, I still get following error

Uncaught (in promise) DOMException: Quota exceeded.
_application-977ce16935600e0a620c1ea565154ab68e46f60a9fe0f207139e0f2128dd9474.js:77250 Uncaught TypeError: Cannot read property 'dasherize' of undefined
    at s.itemHtml (_application-977ce16935600e0a620c1ea565154ab68e46f60a9fe0f207139e0f2128dd9474.js:77250)
    at _application-977ce16935600e0a620c1ea565154ab68e46f60a9fe0f207139e0f2128dd9474.js:77390
    at _ember_jquery-d1d89874d5f08a664c68007c6c2eef5e3bb1cbd8058291fce7818d8ef4ded8ca.js:39008
    at t.u.Mixin.create.c.forEach (_ember_jquery-d1d89874d5f08a664c68007c6c2eef5e3bb1cbd8058291fce7818d8ef4ded8ca.js:38995)
    at t.u.Mixin.create.c.map (_ember_jquery-d1d89874d5f08a664c68007c6c2eef5e3bb1cbd8058291fce7818d8ef4ded8ca.js:39007)
    at s.html (_application-977ce16935600e0a620c1ea565154ab68e46f60a9fe0f207139e0f2128dd9474.js:77389)
    at s.value (_application-977ce16935600e0a620c1ea565154ab68e46f60a9fe0f207139e0f2128dd9474.js:80621)
    at s.value (_application-977ce16935600e0a620c1ea565154ab68e46f60a9fe0f207139e0f2128dd9474.js:80371)
    at s (_vendor-7fd29296ee54f8a7ced9508b106a09ec4aae4912ed1cf10eceb7eb2acca03309.js:20669)
    at t.exports (_vendor-7fd29296ee54f8a7ced9508b106a09ec4aae4912ed1cf10eceb7eb2acca03309.js:20652)

And when file opened, it shows following

define("discourse/widgets/quick-access-notifications", ["discourse/lib/ajax", "discourse/widgets/widget", "discourse/widgets/quick-access-panel"], function (_ajax, _widget, _quickAccessPanel) {
  "use strict";

  (0, _widget.createWidgetFrom)(_quickAccessPanel.default, "quick-access-notifications", {
    buildKey: function buildKey() {
      return "quick-access-notifications";
    },
    emptyStatePlaceholderItemKey: "notifications.empty",

    markReadRequest: function markReadRequest() {
      return (0, _ajax.ajax)("/notifications/mark-read", { type: "PUT" });
    },
    newItemsLoaded: function newItemsLoaded() {
      if (!this.currentUser.enforcedSecondFactor) {
        this.currentUser.set("unread_notifications", 0);
      }
    },
    itemHtml: function itemHtml(notification) {
      var notificationName = this.site.notificationLookup[notification.notification_type];

      return this.attach(notificationName.dasherize() + "-notification-item", notification, {}, { fallbackWidgetName: "default-notification-item" });
    },
    findNewItems: function findNewItems() {
      return this._findStaleItemsInStore().refresh();
    },
    showAllHref: function showAllHref() {
      return this.attrs.path + "/notifications";
    },
    hasUnread: function hasUnread() {
      return this.getItems().filterBy("read", false).length > 0;
    },
    _findStaleItemsInStore: function _findStaleItemsInStore() {
      return this.store.findStale("notification", {
        recent: true,
        silent: this.currentUser.enforcedSecondFactor,
        limit: this.estimateItemLimit()
      }, { cacheKey: "recent-notifications" });
    }
  });
});

Just noticed that this issue only happens when I’m logged in as an admin user and mini_profiler is being displayed as well. I’ve logged in using normal user and it’s working as expected.

1 Like

See:

Maybe clear all local storage

I have cleared the storage, it doesn’t display quota error now. However, it continue to make multiple requests and I get 429 response tellling to slow down. I’m now not using Cloudflare (Should I also comment out cloudflare template from app.yml?). And the error is same at dasherize. I get these errors for admin user only. And I quickly get rate limited.

What non-official plugins, and themes, are you running? It’s possible one is generating a large request load.

I’m using the following plugins

As a starter for ten I would comment out every plugin you aren’t using. Installed but disabled still burdens your system.

Start by disabling all third party plugins (the ones without the green checkmark). Most likely that’s your problem.

I have removed cloudflare, removed many plugins and third party plugins, but the issue is still not resolved.

Remove everything that does not have a green checkmark and rebuild.

Confirm the same failure happens on some other computer, maybe you are out of disk space or have some other local issue.

2 Likes

On my mobile browser it’s working :slight_smile: I will look into it, as what’s the local issue I have? It’s probably the disk space and slow disk drive related. Anyways, it’s good that I have got rid of several unnecessary plugins :laughing:

1 Like

Turns out I’m still facing this issue with some of the users.

I think my issue is related to this issue mentioned below and I’m experiencing this issue after upgrading to this version

I am not able to figure out what is causing this issue. It works for the new users and for others it doesn’t work. I was using a discourse follow plugin and then I commented that out. And now I’m seeing this issue. Could it be possible that I’m having this issue because I have removed that plugin? Because I’m assuming that it’s happening with those users which probably had some followers or used that plugin? It’s a wild assumption actually. Can this plugin be responsible for that?

Yes, that is possible. Since we don’t own said plugin we have no idea if that is the case. You can try enabling it again and checking. If it fixes the problem, report it at the plugin topic.

2 Likes

@Falco Yep, It does solve this issue. I have readded the discourse-follow plugin and it solved the issue. Thanks :slight_smile:

3 Likes