英文:
Google App Engine - 404 but only for .js files
问题
I have a nuxt app deployed to GAE. My previous deploy happened about a month ago, the app was working as expected after that. I made some text changes recently, but after deploying saw that the app is not working as all the requests against .js files returned with 404.
My app.yml looks like the following:
runtime: nodejs14
instance_class: F2
handlers:
- url: /_nuxt
static_dir: .nuxt/dist/client
secure: always
- url: /(.*\.(gif|png|jpg|ico|txt))$
static_files: static/
upload: static/.*\.(gif|png|jpg|ico|txt)$
secure: always
- url: /.*
script: auto
secure: always
env_variables:
HOST: '0.0.0.0'
NODE_ENV: 'staging'
I've double-checked in GAE's debugger that the .js files are there in the .nuxt/dist/client
folder. I have an additional file there /.nuxt/dist/client/LICENSE
, and GAE returns that without any problem when triggering a request <domain>/_nuxt/LICENSE
. So it's just the .js files GAE doesn't want to serve...
Does anyone have any suggestion?
Thanks in advance!
Update:
I cannot see any error other than the fact of the 404 response. Here're the logs and how dev-tools looks like.
英文:
I have a nuxt app deployed to GAE. My previous deploy happened about a month ago, the app was working as expected after that. I made some text changes recently, but after deploying saw that the app is not working as all the requests against .js files returned with 404.
My app.yml looks like the following:
runtime: nodejs14
instance_class: F2
handlers:
- url: /_nuxt
static_dir: .nuxt/dist/client
secure: always
- url: /(.*\.(gif|png|jpg|ico|txt))$
static_files: static/
upload: static/.*\.(gif|png|jpg|ico|txt)$
secure: always
- url: /.*
script: auto
secure: always
env_variables:
HOST: '0.0.0.0'
NODE_ENV: 'staging'
I've double checked in GAEs debugger that the .js files are there in the .nuxt/dist/client
folder. I have an additional file there /.nuxt/dist/client/LICENSE
, and GAE returns that without any problem when triggering a request <domain>/_nuxt/LICENSE
. So it's just the .js files GAE doesn't want to serve...
Does anyone any suggestion?
Thanks in advance!
Update:
I cannot see any error other than the fact of the 404 response. Here're the logs and how dev-tools looks like.
答案1
得分: 1
如果您正在使用自定义服务器与Nuxtjs,我的解决方案是在app.yaml
中删除这两个处理程序。
由于某种原因,我的部署今天失败了,并且已经修复了。
handlers:
# - url: /_nuxt
# static_dir: .nuxt/dist/client
# secure: always
# - url: /(.*\.(gif|png|jpg|ico|txt))$
# static_files: static/
# upload: static/.*\.(gif|png|jpg|ico|txt)$
# secure: always
- url: /.*
script: auto
secure: always
英文:
If you're using custom server with your Nuxtjs, my solution is removing these two handlers in app.yaml
.
For some reason my deployment failed today and got it fixed.
handlers:
# - url: /_nuxt
# static_dir: .nuxt/dist/client
# secure: always
# - url: /(.*\.(gif|png|jpg|ico|txt))$
# static_files: static/
# upload: static/.*\.(gif|png|jpg|ico|txt)$
# secure: always
- url: /.*
script: auto
secure: always
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论