Cannot delete user

I still cannot repro this :disappointed:.

I have a group autogroup that all users with gmail.com emails are added to, including existing users, and set a primary. I can still delete a user who signs up using Google oAuth2 or via local logins and is added to the group.

Group settings screenshot

Iā€™m running into this problem now too on my site. There are a few test user accounts I created - one of them a staged user - and I am unable to delete them. I try to delete the userā€™s posts via the user admin, but it has no effect.

40%20PM

Have you tried out Michaelā€™s workaround ? (if applicable)

thanks, but that workaround did not work for me - no group auto-add for the userā€™s email domain.

I am also having issues with anonymizing or deleting users, when I go to /admin/users/list/active and attempt to delete or anonymize any user who has last_emailed_at set to -- the system errors out.

What is the specific error? Is there an entry in the logs?

3 Likes

When trying to delete from admin, is it giving no response and then later you get an error message? Iā€™ve seen that recently.

2 Likes

I get the error message that @tobiaseigen posted above when going through the UI. When I attempt to anonymize I get a pop up that reads,

There was a problem anonymizing the account.

Looking at production.log I can see the following:

Started DELETE "/admin/users/8911.json" for {BLOCKED_IP} at 2018-04-20 17:03:11 +0000
Processing by Admin::UsersController#destroy as JSON
  Parameters: {"context"=>"/admin/users/8911/{USER}", "delete_posts"=>"true", "id"=>"8911"}
Completed 500 Internal Server Error in 320ms (ActiveRecord: 84.9ms)
Aws::S3::Errors::AccessDenied (Access Denied)
Started PUT "/admin/users/8911/anonymize.json" for {BLOCKED_IP} at 2018-04-20 17:02:08 +0000
Processing by Admin::UsersController#anonymize as JSON
  Parameters: {"user_id"=>"8911"}
Completed 500 Internal Server Error in 513ms (ActiveRecord: 44.2ms)
Aws::S3::Errors::AccessDenied (Access Denied)

I am using AWS S3 for hosting attachments, however this user does not have anything in there. I will play around with AWS IAM permissions and see if I can resolve this, looking at CloudWatch I do NOT see any errors pertaining to this.

3 Likes

Can you give some more info on how we could replicate this locally?

Are these test users or actual users? Are they part of any groups? Do they have any posts or pms?

I think in my case they are all staged users.

donā€™t have time just now to look in the logs - will come back to this later if you still need my help.

thanks for looking into this! :sunflower:

Like a user that was created because they emailed in?

yep. though in this case they were created because I emailed out to them by creating a new message including their email address.

when I try to delete one of my staged users, I get this in the error log:

Click to expand
/var/www/discourse/plugins/discourse-assign/lib/topic_assigner.rb:164:in `unassign' /var/www/discourse/plugins/discourse-assign/plugin.rb:195:in `block (2 levels) in activate!' /var/www/discourse/lib/plugin/instance.rb:258:in `block in on' /var/www/discourse/lib/discourse_event.rb:12:in `block in trigger' /usr/local/lib/ruby/2.4.0/set.rb:324:in `each_key' /usr/local/lib/ruby/2.4.0/set.rb:324:in `each' /var/www/discourse/lib/discourse_event.rb:11:in `trigger' /var/www/discourse/app/models/post_action.rb:157:in `agree_flags!' /var/www/discourse/lib/post_destroyer.rb:197:in `agree_with_flags' /var/www/discourse/lib/post_destroyer.rb:115:in `block in perform_delete' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:233:in `transaction' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction' /var/www/discourse/lib/post_destroyer.rb:107:in `perform_delete' /var/www/discourse/lib/post_destroyer.rb:50:in `destroy' /var/www/discourse/app/services/user_destroyer.rb:40:in `block (2 levels) in destroy' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/relation/delegation.rb:39:in `each' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/relation/delegation.rb:39:in `each' /var/www/discourse/app/services/user_destroyer.rb:27:in `block in destroy' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction' /usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction' /var/www/discourse/app/services/user_destroyer.rb:21:in `destroy' /var/www/discourse/app/controllers/admin/users_controller.rb:369:in `destroy' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:in `process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb:30:in `process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:131:in `run_callbacks' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:19:in `process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/rescue.rb:20:in `process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `block in instrument' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:in `instrument' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `instrument' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:30:in `process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/params_wrapper.rb:252:in `process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/railties/controller_runtime.rb:22:in `process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:124:in `process' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/rendering.rb:30:in `process' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-mini-profiler-1.0.0/lib/mini_profiler/profiling_methods.rb:78:in `block in profile_method' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:189:in `dispatch' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:253:in `dispatch' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:31:in `serve' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/mapper.rb:46:in `serve' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:50:in `block in serve' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `each' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `serve' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:834:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.1/lib/rack/protection/frame_options.rb:31:in `call' /var/www/discourse/lib/middleware/omniauth_bypass_middleware.rb:24:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/conditional_get.rb:38:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/head.rb:12:in `call' /var/www/discourse/lib/middleware/anonymous_cache.rb:149:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:232:in `context' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:226:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:in `run_callbacks' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:24:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/logster-1.2.9/lib/logster/middleware/reporter.rb:31:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:36:in `call_app' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:26:in `call' /var/www/discourse/config/initializers/100-quiet_logger.rb:16:in `call' /var/www/discourse/config/initializers/100-silence_logger.rb:29:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb:79:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb:25:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/method_override.rb:22:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/sendfile.rb:111:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-mini-profiler-1.0.0/lib/mini_profiler/profiler.rb:174:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.2/lib/message_bus/rack/middleware.rb:63:in `call' /var/www/discourse/lib/middleware/request_tracker.rb:176:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/urlmap.rb:68:in `block in call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in `each' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in `call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/unicorn-5.4.0/lib/unicorn/http_server.rb:606:in `process_client' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/unicorn-5.4.0/lib/unicorn/http_server.rb:701:in `worker_loop' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/unicorn-5.4.0/lib/unicorn/http_server.rb:549:in `spawn_missing_workers' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/unicorn-5.4.0/lib/unicorn/http_server.rb:142:in `start' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/unicorn-5.4.0/bin/unicorn:126:in `<top (required)>' /var/www/discourse/vendor/bundle/ruby/2.4.0/bin/unicorn:23:in `load' /var/www/discourse/vendor/bundle/ruby/2.4.0/bin/unicorn:23:in `<main>'

The users which are not deleting for me were created but not activated in previous Discourse version. I recently updated to the latest version of Discourse and attempted to delete them and ran into errors. Iā€™m not sure if this is a coincidence or if it is the root cause of this problem.

I canā€™t delete a user. Iā€™ve deleted all posts, and it failed, so I deactivated and reactivated, but still no joy. I anonymized, and still no luck. I get the same error. No groups or auto-groups set up for this user.

Version

Installed

[v2.1.0.beta3 +31]

Latest

2.1.0.beta3

Youā€™re up to date!

Iā€™m having the same problem here. I cannot delete several users with same error as described.

If these users donā€™t have any regular posts can you see if these users are part of any groups and also check if they have received any PMā€™s from non-staff or have sent PMā€™s?

1 Like

The user is in the default trust-groups. I was able to delete another users with same membership. I can see several PMs. But it is not possible to delete that PMs. Itā€™s really awkward to delete users in Discourse.

UPDATE:

OK, my solution is to set delete_user_max_post_age onto 2 years. Then Iā€™m able to delete all messages and the user itself. Additional it could be necessary to increase delete_all_posts_max as well.