Missing theme-javascripts assets (http 404) on 2.8 stable

AI-generated summary

Missing theme-javascripts assets (http 404) on 2.8 stable

A user, dmorlock, reported an issue where theme-javascripts files are missing and return a 404 error, despite existing in the javascript-cache. A temporary workaround was to edit and save the custom theme, but the issue would reoccur after 1-2 days.

david inquired about the Discourse version, revealing that a similar issue was fixed in version 2.9.0 (beta). dmorlock confirmed they were using version 2.8.0, prompting david to initiate a backport of the fix to the stable branch. The fix was merged, and dmorlock updated to the stable branch to test the resolution.

We run into an error where the theme-javascripts seems to be missing:

$ curl https://mydomain.com | grep "theme-javascript"
<script src="/theme-javascripts/ff7f780a40bfd1e31a2cdc99c7dbc616f619d7d9.js?__ws=mydomain.com"></script>
<script src="/theme-javascripts/1bb8395b8d8d9daecdbef830d8c9418b93a7b5f9.js?__ws=mydomain.com"></script>

But when we try to access these files (in a browser with a logged in user) we get an 404 error:

Hoppla! Diese Seite existiert nicht oder ist privat.

image

When we check the javascript-cache, the files exist:

$ find /var/www/discourse/tmp/javascript-cache -iname 'ff7f780a40bfd1e31a2cdc99c7dbc616f619d7d9*'
/var/www/discourse/tmp/javascript-cache/ff7f780a40bfd1e31a2cdc99c7dbc616f619d7d9.js

The current workaround is to edit the custom theme by changing and saving the theme.
After 1-2 days, the problem occurs again.

We’d appreciate any help for further investigation.

Thanks,
Daniel.

What version of Discourse are you running? We fixed a similar-sounding issue back in February:

https://github.com/discourse/discourse/commit/7ed899fed97d6b0fe92dba398233f2d143c12129

We are using V2.8.0. Which version contains the mentioned fix?

This fix is only in 2.9.0 (beta). I’ll see whether we can get it backported to stable since it’s a relatively simple fix: (PR here)

Edit: that’s merged into the stable branch @dmorlock. So if you run an upgrade (via the console, or via /admin/upgrade, the issue should be resolved.

We just updated to the stable branch and are currently testing whether this fixed our issue.