Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Problem With GCloud App Deploy: Static File 404 Not Found Error

Hi,

I'm constantly getting a 404 not found error for one of my static files, "desala.txt", every time I deploy my app.

Here is my website file hierarchy:

Screen Shot 2023-02-10 at 10.43.39 AM.png

 Code of my app.yaml:

 

 

runtime: python
env: flex
entrypoint: gunicorn -b :$PORT server:app

manual_scaling:
  instances: 1

runtime_config:
  python_version: 3

 

 

Console log when I visit my site:

Screen Shot 2023-02-11 at 9.42.49 PM.png

 However, visiting https://voltaic-phalanx-XXXXXX.uw.r.appspot.com/static/desala.txt works and shows that it exists. How am I getting this error and how do I fix it?

Solved Solved
1 1 1,980
1 ACCEPTED SOLUTION

Actually found out the error was in my search.js file:

let lines = await readFile("./desala.txt").then(data => data.split("\n"));

I changed this line to:

let lines = await readFile("/static/desala.txt").then(data => data.split("\n"));

And the error was resolved. Thanks Robina for the assist.

View solution in original post

1 REPLY 1

Actually found out the error was in my search.js file:

let lines = await readFile("./desala.txt").then(data => data.split("\n"));

I changed this line to:

let lines = await readFile("/static/desala.txt").then(data => data.split("\n"));

And the error was resolved. Thanks Robina for the assist.

Top Labels in this Space
Top Solution Authors