# Cannot delete user due to S3 storage policies

**URL:** https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332
**Category:** Bug
**Created:** [April 20, 2017, 3:15pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332 "2017-04-20T15:15:22Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [April 20, 2017, 3:15pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/1 "2017-04-20T15:15:22Z")

</div>

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:

 ![](https://global.discourse-cdn.com/meta/original/3X/9/0/90d3d67a34c8b142c62ee3eeb758a69c7e7fab2d.png)

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.

---

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [April 20, 2017, 4:07pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/2 "2017-04-20T16:07:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [April 20, 2017, 4:15pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/3 "2017-04-20T16:15:51Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [April 20, 2017, 4:19pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/4 "2017-04-20T16:19:40Z")

</div>

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

 ![](https://global.discourse-cdn.com/meta/original/3X/4/9/49aab8eb54dd1a799e116fa281cf78bb23f7a869.png)

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [April 20, 2017, 4:25pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/5 "2017-04-20T16:25:38Z")

</div>

![](https://global.discourse-cdn.com/meta/original/3X/2/6/26d6f518442662e11a0869c3a47cb1ae8e3e21f7.PNG)

Are You on the latest Build?

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

---

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [April 20, 2017, 4:28pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/6 "2017-04-20T16:28:35Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [April 20, 2017, 4:30pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/7 "2017-04-20T16:30:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [April 20, 2017, 4:37pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/8 "2017-04-20T16:37:57Z")

</div>

Thanks, will update and report back.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [April 20, 2017, 4:39pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/9 "2017-04-20T16:39:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [April 23, 2017, 9:02pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/10 "2017-04-23T21:02:37Z")

</div>

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:

![](https://global.discourse-cdn.com/meta/original/3X/2/f/2fe9afb311bb65efcf05fd8bc457d3cf9820d53f.png)

Going into the deleted posts shows that one private topic that was deleted still, and trying to click any of the ⚠ 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?

---

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [April 23, 2017, 10:20pm UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/11 "2017-04-23T22:20:39Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [April 28, 2017, 2:19am UTC](https://meta.discourse.org/t/cannot-delete-user-due-to-s3-storage-policies/61332/12 "2017-04-28T02:19:36Z")

</div>


