0

This React website is served on Google Cloud Platform

I want to edit an existing handler

  - url: /(.*)$
    static_files: public/\1/index.html
    upload: public/.*/index.html

to get rid of warnings like this Static file referenced by handler not found: public/_ah/start/index.html

I have seen this solution, but I'm not quite sure how to use it in my case. Any ideas? I tried option below, but it didn't work, build fails.

  - url: /(?!.*\/_ah).*$
    static_files: public/\1/index.html
    upload: public/.*/index.html
LirysJH
  • 184
  • 2
  • 15

1 Answers1

0

An error in an application's app.yaml frequently causes the error static file referenced by handler not found. It basically means that one of app.yaml's static file handlers is diverting to a file that does not exist or is named wrongly.

You might be able to come up with a strategy if you have a technique of differentiating files from directories. You can achieve something like this by stating that all filenames must have extensions (and folders most not. in their names):

/optional/path/folder/ - serve index.html inside

- url: /(.*)/ 
 static_files: public/\1/index.html 
 upload: public/.*/index.html 

/optional/path/name.extension => files - serve them

- url: /((.*\/)*[^\/]+\.[^\/]+)$ 
 static_files: public/\1 
 upload: public/.* 

anything else is a folder - serve index.html inside

- url: /(.*)$ 
 static_files: public/\1/index.html 
 upload: public/.*/index.html

Remember that all this depends on your directory.

Here is also app.yaml and structuring web services documentation that could help.

  • It doesn't help at all. I have these handlers. – LirysJH Dec 06 '21 at 19:52
  • Searching for more documentation or a solution for your issue, I found the following link related to the same error message you are getting, the solution shows the full app.yaml with a brief description. https://stackoverflow.com/questions/31482884/static-file-referenced-by-handler-not-found-index-html And as you can see in the comment section, upload: / to upload: index.html is what solved the issue. – Jose German Perez Sanchez Dec 24 '21 at 18:03