Cannot delete user due to S3 storage policies

AI-generated summary

In a bug report titled ‘Cannot delete user due to S3 storage policies,’ niemeyer reported an inability to delete a user account, even after removing their only topic and noting incorrect negative post counts in the user_stats table niemeyer. Suggesting a UI fix, itsbhanusharma asked if the ‘Delete all topics’ button was visible and proposed upgrading to the latest build. niemeyer confirmed the button was missing and reported being on version 1.8.0.beta9. itsbhanusharma recommended upgrading to Beta 10, noting it fixes several issues niemeyer. Although niemeyer updated to 1.8.10.beta10 +307, the issue persisted, with deleted posts still appearing in the activity log niemeyer. The root cause was eventually identified as an AWS IAM policy on the S3 bucket that blocked deletion operations niemeyer. The policy was subsequently adjusted to allow object deletes (essential for removing user avatars) while maintaining versioning for safety, resolving the error.

Discourse is complaining about existing posts when attempting to delete a user whose only apparent writing interaction with the system was sending a private message asking for the account to be deleted. I’ve deleted that topic, and even then cannot delete the account.

This is how the profile looks like:

Other than the awkward negative topic and posts count, can’t see anything outstanding surrounding the problem.

Maybe it’s the negative count? Where is that kept? Apparently not in users table itself.

2 лайка

The incorrect negative numbers are in the user_stats table, and fixing them by hand still doesn’t allow the account to be deleted. So two independent bugs, apparently.

2 лайка

Do You see Delete Posts Button in the Admin > Users > (Target User) ? Scroll Down to Topics Created and so fields and you’d see a button to delete all topics by a user (including private messages).

Click that and it should probably let you delete the user

or You’d see something like cannot delete posts max post date limit is xx

so you can modify your setting to be … say 360 days and then the button will be automatically enabled.

I cannot see the button. I deleted the one private topic the user had directly in the topic itself. That section looks like:

Are You on the latest Build?

Try visiting {Your Forum URL}/admin/upgrade and upgrade manually?

This is on 1.8.0.beta9.. is the fix in beta10, or do I have to go to tests-passed?

Will the fix work even if it says zero posts at the moment?

it was Introduced in Beta 10 but living on the edge is the best possible choice for you, There are a lot of issues in beta 10 addressed in tests-passed.

I’m on 1.8.0 Beta 10 + 150 Right now.

1 лайк

Thanks, will update and report back.

Sure! … Will dig into it if I could help in any other way.

also, You may rather not try modifying database as there is a strong chance of things getting messed up in case those entries are saved incorrectly.

I’ve updated to 1.8.10.beta10 +307, and the button doesn’t show up, and I still cannot delete this user.

Going to the activity page shows a bar at the top looking like this:

Going into the deleted posts shows that one private topic that was deleted still, and trying to click any of the :warning: Delete buttons results in the same error still: There was an error deleting that user. Make sure all posts are deleted before trying to delete the user.

Any other ideas?

Found the issue: I was using an IAM policy on Amazon’s S3 that prevented deletes as a safety net, because I assumed image uploads were one-way only. Turns out deleting the user attempts to delete content from S3 as well, supposedly to remove the avatar image? Haven’t confirmed that yet, but logs will show in a short while. The S3 delete error eventually cascaded into the standard and in this case misleading “delete all posts” message.

I’ve now opened up the IAM policy for object deletes on the bucket, but preserved it with object versioning, which implies we still get the safety benefits while allowing deletes to happen.

6 лайков