Search code examples
reactjsdjangoapachebitnamiamazon-lightsail

GET js chunk 404'd on all but one chunk


I'm running a react frontend with django backend on aws lightsail (bitnami apache server). Everything had been working fine until I changed some frontend code and reran npm run build on the server. It completed successfully and I see the chunks in the correct static folder. All of them are there.

When I access the website, it loads one of the chunks and then 404's on the rest. The built css chunks are all there, too. I've restarted the apache server a couple times for good measure but have the same problem.

Any idea what could be happening?

edit: additional info. Here are access logs from a time of trying to get it

x.x.x.x - - [04/Jul/2021:18:42:34 +0000] "GET / HTTP/1.1" 200 1112
x.x.x.x - - [04/Jul/2021:18:42:34 +0000] "GET /static/css/2.7d304944.chunk.css HTTP/1.1" 200 8438
x.x.x.x - - [04/Jul/2021:18:42:34 +0000] "GET /static/css/main.48dce226.chunk.css HTTP/1.1" 200 18320
x.x.x.x - - [04/Jul/2021:18:42:34 +0000] "GET /static/js/main.e6e67397.chunk.js HTTP/1.1" 404 196
x.x.x.x - - [04/Jul/2021:18:42:34 +0000] "GET /static/css/2.7d304944.chunk.css.map HTTP/1.1" 200 12167
x.x.x.x - - [04/Jul/2021:18:42:34 +0000] "GET /static/css/main.48dce226.chunk.css.map HTTP/1.1" 200 39165
x.x.x.x - - [04/Jul/2021:18:42:34 +0000] "GET /static/js/2.fc4ff571.chunk.js.map HTTP/1.1" 200 288868
x.x.x.x - - [04/Jul/2021:18:42:37 +0000] "GET /manifest.json HTTP/1.1" 200 1112

And here is the folder opened in cyberduck showing they are all there. enter image description here


Solution

  • I found the solution. The step I was missing in the process was that I needed to run python manage.py collectstatic --noinput after rebuilding the js.