Yvonne Aburrow Yvonne Aburrow -3 years ago 118
YAML Question

JS file in root not loading in Google Appengine

I am adding a service worker in Google Appengine. According to the documentation,

sw.js
must be in the same folder as the HTML file which is calling it.

I added the following to my
app.yaml
file, but I am still getting 404 Not Found for the
sw.js
file:

- url: /(index|sw)\.js$
static_files: \1
upload: (index|sw)\.js$
application_readable: true


I tested my regular expression in regex101.com, so I know that's correct.

I think there's something wrong with the rest of the declaration.

Answer Source

Your regex omits the extension from the static_files file. Try:

- url: /(index|sw)\.js$
  static_files: \1.js
  upload: (index|sw)\.js
  application_readable: true
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download