Reputation: 2907
I have a weird issue on GAE standard
(running node
), more precisely with my app.yaml
below.
runtime: nodejs8
# Environment variables
env_variables:
GOOGLE_CLOUD_PROJECT: '...'
# Static directories and files
handlers:
- url: /static
static_dir: public
Without the handlers
part, everything works like a charm: my app is deployed and works. Note that the size
is 4.8 MB (version 1-0-43
).
However, with the handlers
part, my app doesn't work anymore: 4xx
error and an app size
of 324 KB (version 1-0-43
).
The sole purpose of the handlers
part is to define a directory
to serve static assets (CSS, JS, images...).
Any clue? Thanks.
Upvotes: 1
Views: 90
Reputation: 39824
When you add your static_dir
handler definition the entire content of your public
subdirectory is no longer (by default) uploaded together with your app code (most likely explaining the app size difference). Instead it's uploaded to a different location to be served directly by the GAE infra, see How to serve static files in AppEngine Standard and nodejs
It sounds that your app may need some of those files as well. In such case the easiest solution would be to add the application_readable
flag to the static definition, causing that directory to be uploaded both in the static content location and together with your app code, see GAE: file_get_contents() and static files.
To speedup your deployments could also try to separate the static content in 2: one portion not needed by your app code, deployed without application_readable
(thus not also uploaded with your app code, deployed faster) and one with the flag. If it's not too much trouble.
Upvotes: 1
Reputation: 96
Could you try changing static_dir from 'public' to 'static'. Because the url and static_dir are usually located at the same place. Please try it and let me know. Cheers!
# Static directories and files
handlers:
- url: /static
static_dir: static
Upvotes: 0