# Rebuild failure - skipping "after\_assets\_precompile" section of app.yml

**URL:** https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414
**Category:** Self-hosting
**Created:** [January 9, 2025, 11:01pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414 "2025-01-09T23:01:03Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![LotusJeff](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lotusjeff/32/477888_2.png) [@LotusJeff](https://meta.discourse.org/u/LotusJeff)
#### Post date: [January 9, 2025, 11:01pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/1 "2025-01-09T23:01:03Z")

</div>

I just did a ./launcher rebuild app—no changes to system-related files. I am now stuck on the discourse blinking dots.

I checked the following:

- The docker ps shows the discourse app image (seems normal).
- Top command shows activity (seems normal)
- I can view the sidekiq status (seems normal)

So, I rebuilt the app again.

Same results.

I tried using Safe-mode. Everything turned off. No change. I am still receiving the blinking dots screen.

I reviewed every line of the source code. I show I have four js files that are not available. They are:

- [https://cdn.lotuselan.net/assets/chunk.a2077b6f709e79853f13.d41d8cd9.br.js](https://cdn.lotuselan.net/assets/chunk.a2077b6f709e79853f13.d41d8cd9.br.js)
- [https://cdn.lotuselan.net/assets/chunk.4182748ff86aacd88901.d41d8cd9.br.js](https://cdn.lotuselan.net/assets/chunk.4182748ff86aacd88901.d41d8cd9.br.js)
- [https://cdn.lotuselan.net/assets/locales/en-b9880b888cb1d7c6743d93cfa690d7925d515c6df4a9ad42ce1796b463c11344.br.js](https://cdn.lotuselan.net/assets/locales/en-b9880b888cb1d7c6743d93cfa690d7925d515c6df4a9ad42ce1796b463c11344.br.js)
- [https://cdn.lotuselan.net/assets/admin-11fa9e51418d774349288172c52e85f400199eb198a2fa17693204e8faec1782.br.js](https://cdn.lotuselan.net/assets/admin-11fa9e51418d774349288172c52e85f400199eb198a2fa17693204e8faec1782.br.js)

There are numerous missing javascript files. These were the first ones found.

Initial review:

- The files are not available via my CDN delivery.
- The CDN pulls from my S3 bucket.
- The files are not in my S3 bucket where all other assets are stored.

Looking at the rebuild results, I can see the following.

1. The 4 files were created and written to public/assets/ with a js file extension.
2. The 4 files were compressed and saved with a br.js file extension.

Checking my server:

1. All 4 .js files are available on my server
2. The .br.js files are not available on my server
3. The .br.js files are not on my S3 bucket

Going through the rebuild results, It appears the after\_assets\_precompile activity is not happening on my rebuilds. I can manually run a rake s3:upload\_assets and the assets are migrated to S3 and everything works well.

I have checked the following:

1. my yml file passes checks for proper formatting.

What can I check to determine why the after\_assets\_precompile is not processing as part of the rebuild?

note: I am running: 3.4.0.beta4-dev - 6a50b3d4b4

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 9, 2025, 11:06pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/2 "2025-01-09T23:06:46Z")

</div>

Did you add the stanza to upload assets?

[Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916)

> [@Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916/1):
>
> ## Configuration
> 
> In order to store Discourse static assets in your Object Storage add this configuration on your app.yml under the `hooks` section:
> 
> ```plaintext
> after_assets_precompile:
> - exec:
> cd: $home
> cmd:
> - sudo -E -u discourse bundle exec rake s3:upload_assets
> - sudo -E -u discourse bundle exec rake s3:expire_missing_assets
> 
> ```

You can find that rake task there and then run it from inside the container (to save the time of a rebuild). And then do a rebuild once you edit your yml file.

---

<div class="post-metadata">

### Author: ![LotusJeff](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lotusjeff/32/477888_2.png) [@LotusJeff](https://meta.discourse.org/u/LotusJeff)
#### Post date: [January 9, 2025, 11:08pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/3 "2025-01-09T23:08:47Z")

</div>

S3 has been up and running on the site for 43 days. The rake commands were placed there as part of the S3 install.

The site has been rebuilt at least 30 times. I have added additional plugins and components along the way. This would indicate that .js files have been added and populated to the S3 bucket.

The S3 component has been working great. This is the first time I have had any issues with files not being migrated to S3.

What can I investigate to understand why the files were not moved?

Does anyone know what could cause the after\_assets\_precompile not to run?

---

<div class="post-metadata">

### Author: ![LotusJeff](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lotusjeff/32/477888_2.png) [@LotusJeff](https://meta.discourse.org/u/LotusJeff)
#### Post date: [January 10, 2025, 4:41pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/4 "2025-01-10T16:41:12Z")

</div>

Help!

On rebuild, the process skips the following section in the app.yml file:

```plaintext
after_assets_precompile:
  - exec:
      cd: $home
      cmd:
        - sudo -E -u discourse bundle exec rake s3:upload_assets
        - sudo -E -u discourse bundle exec rake s3:expire_missing_assets

```

Immediately after rebuild, I can manually process the commands via:

```plaintext
./launcher enter app
rake s3:upload_assets
rake s3:expire_missing_assets

```

The commands run and process the required files to S3.

I have added an echo command to the after\_assets\_precompile code.

```plaintext
      cmd:
        - echo "Beginning of precompile commands"
        - sudo -E -u discourse bundle exec rake s3:upload_

```

The echo statement never appears in the rebuild output.

The rebuild step processes the steps before and after this section in the app.yml file. It processes all plugins and custom commands.

I have taken the following steps to try and resolve:

1. Removed all plugins
2. Disabled all components
3. Reviewed all the discourse log files. Did not find any errors indicated.
4. Reviewed base system log files. Did not find any errors indicated.

Does anyone have a clue why the rebuild process would skip this section?

---

<div class="post-metadata">

### Author: ![LotusJeff](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lotusjeff/32/477888_2.png) [@LotusJeff](https://meta.discourse.org/u/LotusJeff)
#### Post date: [January 10, 2025, 5:19pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/5 "2025-01-10T17:19:54Z")

</div>

As a test, I moved the **after\_assets\_precompile** commands to the custom command section.

```plaintext
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
  ## command to password protect the website during work. remove for production.
  - exec:
      cd: $home
      cmd:
        - echo "Beginning of precompile commands"
        - sudo -E -u discourse bundle exec rake s3:upload_assets
        - sudo -E -u discourse bundle exec rake s3:expire_missing_assets
  - exec: echo "End of custom commands"

```

The commands worked without any issues. This rules out environmental access or security issues.

The launcher process is skipping the after\_assets\_precompile code during the rebuild.

Any one have a clue?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [January 10, 2025, 5:31pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/6 "2025-01-10T17:31:40Z")

</div>

No clue, but I rebuilded about 4 hours ago without any issues.

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [January 10, 2025, 9:54pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/7 "2025-01-10T21:54:46Z")

</div>

Maybe you have a whitespace or indentation error in your yml file. Search for a validator and check: [validate yaml]

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [January 10, 2025, 10:00pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/8 "2025-01-10T22:00:04Z")

</div>

> [@LotusJeff](#):
>
> ```plaintext
> after_assets_precompile:
> 
> ```

this should not be a top-level key, this should be under `hooks`, e.g.:

```plaintext
hooks:
  after_assets_precompile:
    - exec:
        cd: $home
        cmd:
          - sudo -E -u discourse bundle exec rake s3:upload_assets
          - sudo -E -u discourse bundle exec rake s3:expire_missing_assets

```

---

<div class="post-metadata">

### Author: ![LotusJeff](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lotusjeff/32/477888_2.png) [@LotusJeff](https://meta.discourse.org/u/LotusJeff)
#### Post date: [January 10, 2025, 11:05pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/9 "2025-01-10T23:05:56Z")

</div>

> [@Ed\_S](#):
>
> Maybe you have a whitespace or indentation error in your yml file. Search for a validator and check: [validate yaml]

That was listed in the first post. app.yml was validated for proper indentations.

---

<div class="post-metadata">

### Author: ![LotusJeff](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lotusjeff/32/477888_2.png) [@LotusJeff](https://meta.discourse.org/u/LotusJeff)
#### Post date: [January 10, 2025, 11:30pm UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/10 "2025-01-10T23:30:26Z")

</div>

@supermathie - you are terrific with incredible eyesight. You were able to see that the code was not indented by two spaces. And only from a single snippet versus the more extensive section. Thank you.

I added the two spaces, and that solved the problem.

I had previously run app.yml through a yml checker. The testing tool told me the file was structurally sound. It could not tell me it was functionally wrong.

The correct code snippet should be:

```plaintext
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-adplugin
          - git clone https://github.com/discourse/discourse-affiliate
          - git clone https://github.com/discourse/discourse-subscriptions
          - git clone https://github.com/discourse/discourse-yearly-review
          - git clone https://github.com/discourse/discourse-whos-online
          - git clone https://github.com/discourse/discourse-data-explorer
  # set internal files for cdn
  after_assets_precompile:
    - exec:
        cd: $home
        cmd:
          - echo "Beginning of precompile commands"
          - sudo -E -u discourse bundle exec rake s3:upload_assets
          - sudo -E -u discourse bundle exec rake s3:expire_missing_assets

```

To document the app.yml file. The only top-level keys are:

- templates:
- params:
- env:
- volumes:
- hooks:
- run:

Everything else should be indented.

The simplest of errors can be the most frustrating. Six hours of my life were lost for two spaces.

My kingdom for two spaces.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 11, 2025, 12:44am UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/11 "2025-01-11T00:44:40Z")

</div>

> [@LotusJeff](#):
>
> . Six hours of my life were lost for two spaces.

This happens to me all the time.

My other favorite is editing the wrong file, or the right file on the wrong computer.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [February 10, 2025, 12:45am UTC](https://meta.discourse.org/t/rebuild-failure-skipping-after-assets-precompile-section-of-app-yml/346414/12 "2025-02-10T00:45:25Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
