# Rebuild failed S3 rake aborted

**URL:** https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680
**Category:** Bug
**Created:** [November 9, 2021, 3:35pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680 "2021-11-09T15:35:16Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![AntiMetaman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antimetaman/32/186978_2.png) [@AntiMetaman](https://meta.discourse.org/u/AntiMetaman)
#### Post date: [November 9, 2021, 3:35pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/1 "2021-11-09T15:35:16Z")

</div>

Ok so my discourse has been running fine and I was on the latest version when someone told me that the JS-\> Ember got added, so I need to rebuild.

 ![](https://global.discourse-cdn.com/meta/original/3X/1/5/15012d9c5ecd0cffa4d52d64baabf56db3e6819e.png)

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

[http://forum.duelistsunite.org/NjA5ZGZhNjY4NzkxZTI3.txt](http://forum.duelistsunite.org/NjA5ZGZhNjY4NzkxZTI3.txt)

No changes were made. I simply did a rebuild. The app.yml has no changes. No additions to plugins.

That’s my discourse-doctor log.

---

<div class="post-metadata">

### Author: ![IAmGav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamgav/32/235598_2.png) [@IAmGav](https://meta.discourse.org/u/IAmGav)
#### Post date: [November 9, 2021, 3:45pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/2 "2021-11-09T15:45:49Z")

</div>

this was recently merged

> <https://github.com/discourse/discourse/pull/14802>
>
> This commit introduces a new s3:ensure\_cors\_rules rake task
> that is run as a pr…erequisite to s3:upload\_assets. This rake
> task calls out to the S3CorsRulesets class to ensure that
> the 3 relevant sets of CORS rules are applied, depending on
> site settings:
> 
> \* assets
> \* direct S3 backups
> \* direct S3 uploads
> 
> This works for both Global S3 settings and Database S3 settings
> (the latter set directly via SiteSetting).
> 
> As it is, only one rule can be applied, which is generally
> the assets rule as it is called first. This commit changes
> the ensure\_cors! method to be able to apply new rules as
> well as the existing ones.
> 
> This commit also slightly changes the existing rules to cover
> direct S3 uploads via uppy, especially multipart, which requires
> some more headers.
> 
> \*\*NOTE: Please do not merge this, I will merge it once some internal infrastructure has shifted.\*\*

@cvx @martin

---

<div class="post-metadata">

### Author: ![cvx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cvx/32/152146_2.png) [@cvx](https://meta.discourse.org/u/cvx)
#### Post date: [November 9, 2021, 7:25pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/3 "2021-11-09T19:25:36Z")

</div>

Thank you for reporting this! I opened a PR with a fix: [FIX: Don't fail if `s3_install_cors_rule` is off by cvx · Pull Request #14865 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/14865)

---

<div class="post-metadata">

### Author: ![AntiMetaman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antimetaman/32/186978_2.png) [@AntiMetaman](https://meta.discourse.org/u/AntiMetaman)
#### Post date: [November 9, 2021, 7:56pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/4 "2021-11-09T19:56:50Z")

</div>

Thank you, please let me know when it is merged and I can try to rebuild.

---

<div class="post-metadata">

### Author: ![IAmGav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamgav/32/235598_2.png) [@IAmGav](https://meta.discourse.org/u/IAmGav)
#### Post date: [November 9, 2021, 8:13pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/5 "2021-11-09T20:13:21Z")

</div>

Just waiting on Martin to review the PR.

---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [November 9, 2021, 10:00pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/6 "2021-11-09T22:00:45Z")

</div>

Apologies, I’ve merged the PR now.

---

<div class="post-metadata">

### Author: ![AntiMetaman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antimetaman/32/186978_2.png) [@AntiMetaman](https://meta.discourse.org/u/AntiMetaman)
#### Post date: [November 9, 2021, 11:07pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/7 "2021-11-09T23:07:38Z")

</div>

I’ve ran a rebuild but it still fails:

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/9/29ee4750ff32278f502aa13b7cda840cd03cc544.png)

---

<div class="post-metadata">

### Author: ![AntiMetaman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antimetaman/32/186978_2.png) [@AntiMetaman](https://meta.discourse.org/u/AntiMetaman)
#### Post date: [November 10, 2021, 3:17pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/9 "2021-11-10T15:17:04Z")

</div>

Any advice or updates on this would be appreciated.

---

<div class="post-metadata">

### Author: ![Simon\_Manning](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_manning/32/198596_2.png) [@Simon\_Manning](https://meta.discourse.org/u/Simon_Manning)
#### Post date: [November 10, 2021, 3:36pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/10 "2021-11-10T15:36:07Z")

</div>

The error suggests that rake tasks cannot return so I think the merged fix referenced earlier is incorrect. I don’t have an environment set up to do any testing or create a pull request but I think using the following instead would fix this. (cc @martin)

Replacing [lines 180 to 187](https://github.com/discourse/discourse/blob/295b998cccccdce644233cceb722962811d41771/lib/tasks/s3.rake#L180-L187):

```plaintext
  if !result
    puts "Skipping"
  else
    puts "Assets rules status: #{result[:assets_rules_status]}."
    puts "Backup rules status: #{result[:backup_rules_status]}."
    puts "Direct upload rules status: #{result[:direct_upload_rules_status]}."
  end

```

---

<div class="post-metadata">

### Author: ![cvx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cvx/32/152146_2.png) [@cvx](https://meta.discourse.org/u/cvx)
#### Post date: [November 10, 2021, 3:54pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/11 "2021-11-10T15:54:29Z")

</div>

My bad! Fixed this (and other rake tasks) in [FIX: `LocalJumpError` in rake tasks by cvx · Pull Request #14874 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/14874)

---

<div class="post-metadata">

### Author: ![AntiMetaman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antimetaman/32/186978_2.png) [@AntiMetaman](https://meta.discourse.org/u/AntiMetaman)
#### Post date: [November 10, 2021, 4:09pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/12 "2021-11-10T16:09:30Z")

</div>

I’m afraid no dice yet. This is after the above merge.

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/9/c95e796975fac9d70a4a959adc408ef6a1dbac65.png)

---

<div class="post-metadata">

### Author: ![Simon\_Manning](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_manning/32/198596_2.png) [@Simon\_Manning](https://meta.discourse.org/u/Simon_Manning)
#### Post date: [November 10, 2021, 4:11pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/13 "2021-11-10T16:11:26Z")

</div>

Note that rebuilding right now (at time of writing) will still fail if you’re on tests-passed as the tests haven’t completed yet. If you look at the [commit page](https://github.com/discourse/discourse/commit/b72688340ffdf0d7424e1914644ec93c800812f6), you’ll see an orange dot to the left of the title indicating that the tests are still in progress:

When that changes to a green tick or (more likely) a red cross, the tests are complete. Then you can rebuild. (An experimental test will probably fail, hence the red cross, but that doesn’t affect tests-passed.)

**Edit** : Looking at the `tests-passed` branch as @cvx suggests is more useful. Looks like it’s good to go now.

---

<div class="post-metadata">

### Author: ![cvx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cvx/32/152146_2.png) [@cvx](https://meta.discourse.org/u/cvx)
#### Post date: [November 10, 2021, 4:11pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/14 "2021-11-10T16:11:26Z")

</div>

It hasn’t made it yet to the `tests-passed` branch: [GitHub - discourse/discourse at tests-passed · GitHub](https://github.com/discourse/discourse/tree/tests-passed)

---

<div class="post-metadata">

### Author: ![AntiMetaman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antimetaman/32/186978_2.png) [@AntiMetaman](https://meta.discourse.org/u/AntiMetaman)
#### Post date: [November 10, 2021, 6:17pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/15 "2021-11-10T18:17:04Z")

</div>

Happy to report that it works!

---

<div class="post-metadata">

### Author: ![cvx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cvx/32/152146_2.png) [@cvx](https://meta.discourse.org/u/cvx)
#### Post date: [November 10, 2021, 9:36pm UTC](https://meta.discourse.org/t/rebuild-failed-s3-rake-aborted/208680/16 "2021-11-10T21:36:59Z")

</div>


