Delete user feature stopped working on staging/production docker setups, but works on local (no docker setup)

AI-generated summary

Issue: Delete user feature stopped working on staging/production Docker setups, but works on local (no Docker setup).

Description: Stefan_Brighiu_M reported an issue where the delete user secondary window does not show on staging/prod (Docker setup). He has tried debugging and checking the console and logs but found nothing. The issue started a few weeks ago, and he suspects it might be related to JavaScript.

Investigation:

  • Canapin asked for the Discourse version and any errors in the browser dev tools console or logs, but Stefan_Brighiu_M found none.
  • Stephen pointed out that the Discourse version (2.5.0.beta7) is quite old and suggested upgrading. However, Stefan_Brighiu_M explained that they have a custom plugin and a complex setup, making upgrades challenging.
  • Stephen suggested looking into commits after the release, but Stefan_Brighiu_M mentioned that nothing has changed since the issue started.
  • Stephen asked again about errors in logs or the browser console, but Stefan_Brighiu_M confirmed finding none.

Custom Plugin and Setup:

  • Stefan_Brighiu_M explained that their custom plugin runs most of the logic and handles data storage, authentication, and authorization.
  • Stephen asked why the custom plugin does not appear in the plugins list, and Stefan_Brighiu_M clarified that it’s built into the code.

Potential Causes:

  • Stephen mentioned that the base image might have been updated, potentially causing issues with the older environment. However, Stefan_Brighiu_M ruled this out due to their specific Docker image build process.

Temporary Solution:

  • Stefan_Brighiu_M decided to create a deletion flow in their admin dashboard, as the DELETE endpoint works properly for simple users.

Hi everyone,

I have an issue where the delete user secondary window (the one that actually deletes the user, does not show on staging/prod (docker setup), but works fine locally - no docker setup)


Nothing happens when I press delete only. On local, it proceeds to show “Deleting…” and deletes the user.

It just stopped working a few weeks ago. I was using it to delete users in December last year.

Hi Stephan :wave:

Can you share your Discourse version?

Is there any error in the browser dev tools console?

Is there any error in the logs from your Discourse admin panel?

Nothing anywhere, it’s like the code is not called, I looked it over locally and debugged it, it all runs ok. It’s really weird.

Installed

2.5.0.beta7

( 2a17124a5b )

2.5 is pretty old now- about two and a half years, Discourse just hit 3.0.

Is there any reason you aren’t upgrading?

Uh so many in fact :slight_smile:

We have a custom plugin that runs all the logic, making discourse just a tool for storing data and handling basic authorization and authentication. We run a mobile-first API that also handles the payment validation and social logins with mobile apps (custom flows) among other advanced features :slight_smile:

My issue is not really with the discourse setup as a whole, or with the version, as it was running well for 3 years and it will still run for a few years because it has no strict dependencies on anything, and we have it hosted on a dedicated server.

I really need someone to tell me how to go about finding out why when pressing the action, there is nothing happening… As I see it, it’s all javascript

destroy(opts) {
    const user = this;
    const message = I18n.t("admin.user.delete_confirm");
    const location = document.location.pathname;

    const performDestroy = function(block) {
      bootbox.dialog(I18n.t("admin.user.deleting_user"));
      let formData = { context: location };
      if (block) {
        formData["block_email"] = true;
        formData["block_urls"] = true;
        formData["block_ip"] = true;
      }
      if (opts && opts.deletePosts) {
        formData["delete_posts"] = true;
      }
      return ajax(`/admin/users/${user.get("id")}.json`, {
        type: "DELETE",
        data: formData
      })
        .then(function(data) {
          if (data.deleted) {
            if (/^\/admin\/users\/list\//.test(location)) {
              document.location = location;
            } else {
              document.location = getURL("/admin/users/list/active");
            }
          } else {
            bootbox.alert(I18n.t("admin.user.delete_failed"));
            if (data.user) {
              user.setProperties(data.user);
            }
          }
        })
        .catch(function() {
          AdminUser.find(user.get("id")).then(u => user.setProperties(u));
          bootbox.alert(I18n.t("admin.user.delete_failed"));
        });
    };

    const buttons = [
      {
        label: I18n.t("composer.cancel"),
        class: "btn",
        link: true
      },
      {
        label:
          `${iconHTML("exclamation-triangle")} ` +
          I18n.t("admin.user.delete_and_block"),
        class: "btn btn-danger",
        callback: function() {
          performDestroy(true);
        }
      },
      {
        label: I18n.t("admin.user.delete_dont_block"),
        class: "btn btn-primary",
        callback: function() {
          performDestroy(false);
        }
      }
    ];

    bootbox.dialog(message, buttons, { classes: "delete-user-modal" });
  },

Have you looked at the commits which followed that particular release?

It could just be a bug specific to that version. If it ever worked on that build I would be investigating what else has changed.

Have you updated anything since locking in at that build? Any third party plugins?

Nope.. it stopped working mid-January or so, while the app was already running. It’s very weird.

And there are no errors in /logs or your browser console?

This is my plugins list :slight_smile:

The people at docker_manager did some things recently, DEV: Resolve deprecations in upgrade-notice component (#162) · discourse/docker_manager@98205ea · GitHub, that bricked my setup for a few days until I found it… But that’s kind of it.

Have you pinned the Discourse version in your app.yml?

If you have a custom plugin why doesn’t it appear in the plugins list? How was this instance installed?

It’s kind of hard to have something move in the config :slight_smile:

I sent the version from the deployed version, the docker is created with that version, and everything is pinned.

Well I wrote it :slight_smile:
It pulls data when the container is built and ran :slight_smile: so it’s only visible in code.

Is there any risk the base image got updated though? Discourse_docker went up to ruby 3.1 in Jan and we’ve seen a number of older environments behave unpredictably with the change.

Nope, the code links to a cloned branch inside our repo and the way we build the docker image, no-one has access to build another one. No way.

So I created the last docker image around 5-6 months ago… And I still think it was pointing to the version of docker that was up when my discourse version was new :slight_smile: as we saved everything ahead of time. - Yup 24 Jun 2020 :slight_smile:

FYI: removed docker_manager as well. Nothing changed

For now, I decided to just create a deletion flow in our admin dashboard, I’m not really sure what happens in the UI, but the DELETE endpoint works properly and does not fail for simple users (not admin, not moderators).

If anyone can help with this, it would be nice to have :slight_smile: