old version files still appearing in google app engine - google-app-engine

My old version files are still appearing in Google App Engine (URL) even when:
I tested new version after uploading ( 2.appid.appspot.com)
Made new version as default version from dashboard.
deleted old version.
Cleared memcache
All new directories and files are created, but old files are not overwritten.
Okay let me put it in detail, initially i created version 1 using app.yaml:
application: app-id
version: 1
runtime: python27
api_version: 1
threadsafe: yes
default_expiration: "7d"
handlers: - url: /static/(..html) static_files: static/\1 upload: static/(..html)
url: /static/(..(css)) static_files: static/\1 upload: static/(..(css))
url: /static/(..(bmp|gif|ico|jpeg|jpg|png))$ static_files: static/\1 upload: static/(..(bmp|gif|ico|jpeg|jpg|png))
url: /static/(..(bmp|gif|ico|jpeg|jpg|png))$ static_files: static/\1 upload: static/(..(bmp|gif|ico|jpeg|jpg|png))
url: /static/(..mp4) static_files: static/\1 mime_type: static/mp4 upload: static/(..mp4)
url: .* script: main.app
libraries: - name: webapp2 version: "2.5.2"
then I created version 2 by using same app.yaml:
application: app-id
version: 2
runtime: python27
api_version: 1
threadsafe: yes
default_expiration: "7d"
handlers: - url: /static/(..html) static_files: static/\1 upload: static/(..html)
url: /static/(..(css)) static_files: static/\1 upload: static/(..(css))
url: /static/(..(bmp|gif|ico|jpeg|jpg|png))$ static_files: static/\1 upload: static/(..(bmp|gif|ico|jpeg|jpg|png))
url: /static/(..(bmp|gif|ico|jpeg|jpg|png))$ static_files: static/\1 upload: static/(..(bmp|gif|ico|jpeg|jpg|png))
url: /static/(..mp4) static_files: static/\1 mime_type: static/mp4 upload: static/(..mp4)
url: .* script: main.app
libraries: - name: webapp2 version: "2.5.2"
tested version 2 i.e. 2.app-id.appspot.com was working
went to dashboard made version 2 as default and then i deleted version 1 , but now:
1) static folder had 1 file named side.css (in version 1) and modified side.css (in version 2 ) and both are available via app-id.appspot.com/static/side.css and 2.app-id.appspot.com/static/side.css (modified)??
How can I remove old side.css available at app-id.appspot.com/static/side.css ???

Head to your Google Cloud Console and open your project. Under the left hamburger menu, head to Storage -> Browser. There you should find at least one Bucket: your-project-name.appspot.com. Under the Lifecycle column, click on the link with respect to your-project-name.appspot.com. Delete any existing rules, since they may conflict with the one you will create now.
Create a new rule by clicking on the 'Add rule' button. For the object conditions, choose only the 'Newer version' option and set it to 1. Don't forget to click on the 'Continue' button. For the action, select 'Delete' and click on the 'Continue' button. Save your new rule.
This new rule will take up to 24 hours to take effect, but at least for my project it took only a few minutes. Once it is up and running, the version of the files being served by your app under your-project-name.appspot.com will always be the latest deployed, solving the problem. Also, if you are routinely editing your static files, you should remove any expiration element from handlers related to those static files and the default_expiration element from the app.yaml file, which will help avoid unintended caching by other servers.

Related

Google App Engine quota error, yet no quota exceeded

I'm getting the following error when trying to deploy my app to Google App Engine using gcloud app deploy.
error [INTERNAL]: An internal error occurred while processing task /appengine-flex-v1/insert_flex_deployment/flex_create_resources>2020-05-22T15:14:57.416Z3210.jc.5: Deployment Manager operation thesis-lock/operation-1590160497681-5a63e1799a578-3c148be2-663d8bc4 errors: [code: "RESOURCE_ERROR"
location: "/deployments/aef-flex-20200522t171231/resources/aef-flex-20200522t171231"
message: "{\"ResourceType\":\"compute.beta.regionAutoscaler\",\"ResourceErrorCode\":\"403\",\"ResourceErrorMessage\":{\"code\":403,\"errors\":[{\"domain\":\"usageLimits\",\"message\":\"Exceeded limit \'QUOTA_FOR_INSTANCES\' on resource \'aef-flex-20200522t171231\'. Limit: 8.0\",\"reason\":\"limitExceeded\"}],\"message\":\"Exceeded limit \'QUOTA_FOR_INSTANCES\' on resource \'aef-flex-20200522t171231\'. Limit: 8.0\",\"statusMessage\":\"Forbidden\",\"requestPath\":\"https://compute.googleapis.com/compute/beta/projects/.../regions/europe-west1/autoscalers\",\"httpMethod\":\"POST\"}}"
I've been able to deploy previously without any problems or errors in exactly the same way. I haven't changed my app.yaml. I have checked my quota in the Console yet I can find no quota that have been exceeded. The documentation does not provide any insights.
Any ideas as to what I can do?
I have found some similar questions on SO, but none of them seem to point to this issue specifically and none of the proposed solutions to those questions seem to work.
I have gone through the same. After digging it for 3 days. I found a solution which worked for me. I have opted to use standard environment instead of env: flex (flex environment). I have changed my config file i.e., app.yaml like the following.
a detailed form with each file type.
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /(.+\.js)
static_files: app/\1
upload: app/(.+\.js)
- url: /(.+\.css)
static_files: app/\1
upload: app/(.+\.css)
- url: /(.+\.png)
static_files: app/\1
upload: app/(.+\.png)
- url: /(.+\.jpg)
static_files: app/\1
upload: app/(.+\.jpg)
- url: /(.+\.svg)
static_files: app/\1
upload: app/(.+\.svg)
- url: /favicon.ico
static_files: app/favicon.ico
upload: app/favicon.ico
- url: /(.+\.json)
static_files: app/\1
upload: app/(.+\.json)
- url: /(.+)
static_files: app/index.html
upload: app/index.html
- url: /
static_files: app/index.html
upload: app/index.html
If you are going to deploy nodejs application change runtime to nodejs(version) delete threaddSafe and api_version rest are same.

google app engine: url not found on this server/404 error

I have code cloned from GitHub Zorya. I just added a www folder and an index.html file in it as I read somewhere that error was because there was no www directory.
Here's how my app structure looks like:
My app.yaml file:
runtime: python27
api_version: 1
threadsafe: true
service: default
builtins:
- deferred: on
# Handlers define how to route requests to your application.
handlers:
- url: /api/v1/(.*)
script: main.app
- url: /tasks/(.*)
script: main.app
- url: /
static_files: build/index.html
upload: build/index.html
- url: /favicon\.png
static_files: build/favicon.png
upload: build/favicon\.png
# unused for now
# - url: /service-worker\.js
# static_files: build/service-worker.js
# upload: build/service-worker\.js
- url: /manifest\.json
static_files: build/manifest.json
upload: build/manifest\.json
- url: /static/(.*)
static_files: build/static/\1
upload: build/static/(.*)
- url: .*
static_files: build/index.html
upload: build/index.html
# here if you want to use them. See
# https://developers.google.com/appengine/docs/python/tools/libraries27 for
# a list of libraries included in the SDK. Third party libs that are *not*
part
# of the App Engine SDK don't need to be listed here, instead add them to
your
# project directory, either as a git submodule or as a plain subdirectory.
#libraries:
#- name: jinja2
# version: latest
libraries:
- name: ssl
version: latest
- name: numpy
version: "1.6.1"
skip_files:
- ^\.git$
- ^\client$
- ^\venv$
# needed for dev_appserver.py, tracks too many changes otherwise
- .*/zorya/client
Here's one of the errors that I see in the logs :
Your requests for /favicon.ico (shown in the comment log) and for / (from the logs image) both match the .* handler pattern, for which you have configured serving a build/index.html static resource.
But you don't have a build directory under the zorya app/service directory, so your static resource doesn't exist. Hence the 404 error.
Maybe you mean to use www instead of build? If so you should match the name of the directory with the one used in the handler pattern. You could just rename the www directory to build (no, you don't need to use that exact name).
In particular for the favicon error, you may want to specify a handler for favicon.ico instead of favicon.png

App Engine on page refresh gives 404 for my angular2 project?

The question is very similar to How do I make Angular 2 routing work with App Engine on page refresh? but I do not have enough points to comment and it says not to put questions in answers.
Anyway same problem except it's a static hosted site on appspot with angular cli dist folder being used:
Project
|
+--dist
|
+--index.html
+--inline.js
+--inline.map
+--main.bundle.js
+--main.map
+--styles.bundle.js
+--styles.map
+--app.yaml
+--index.yaml
I tried changing my app.yaml to something similar to Dan's answer linked above but can't work it out? Here is the app.yaml file:
application:
version:
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /(.*\.js)
static_files: dist/\1
upload: dist/(.*\.js)
- url: /(.*\.map)
mime_type: application/octet-stream
static_files: dist/\1
upload: dist/(.*\.map)
- url: /
static_files: dist/index.html
upload: dist/index.html
- url: /(.*)
static_files: dist/\1
upload: dist/(.*)
Thanks
try this handlers:
- url: /(.*\.(gif|png|jpg|css|js)(|\.map))$
static_files: dist/\1
upload: dist/(.*)(|\.map)
- url: /(.*)
static_files: dist/index.html
upload: dist/index.html
add file extensions in the first handler if your app uses more.
works for my app...

Hosting jekyll to Google App engine

Built a personal blog using jekyll. Everything works well on local host. I do not want to deploy it on github. I prefer hosting on google app engine for some reasons.
I followed some instructions online and copied _site folder generated to my google app engine project.
this is how app.yaml looks like:
application: myblog
version: 1
runtime: python27
api_version: 1
threadsafe: yes
error_handlers:
- file: /404.html
handlers:
- url: /
static_files: _site/index.html
upload: _site/index.html
- url: /(.*)
static_files: _site/\1
upload: _site/(.*)
libraries:
- name: webapp2
version: "2.5.2"
when i run it locally on google app engine, only the index.html and some other files displays. others shows page not found. Is there anything I am not implementing properly ?
Well, I finally figure it out. It is a little trick anyway.
First in your _config.yaml file add:
permalink: /posts/:title/index.html
after that, run jekyll serve to generate the static file in _site folder. Copy the the post folder to _site/ in your app engine project.
Then, in your _config.yaml file change permalink to:
permalink: /posts/:title
run jekyll serve to generate the static file in _site. Copy the entire files generated excluding posts folder into _site/ into your app engine project.
then, make your appengine app.yaml look somewhat like this:
application: myblog
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /(.*\.js)
mime_type: text/javascript
static_files: _site/\1
upload: _site/(.*\.js)
- url: /(.*\.(jpg|png|ico))
static_files: _site/\1
upload: _site/(.*\.img)
- url: /(.*\.css)
mime_type: text/css
static_files: _site/\1
upload: _site/(.*\.css)
- url: /(.*\.(eot|svg|svgz|otf|ttf|woff|woff2))
static_files: _site/\1
upload: _site/(.*\.fonts)
- url: /
static_files: _site/index.html
upload: _site/index.html
- url: /(.+)/
static_files: _site/\1/index.html
upload: _site/(.+)/index.html
expiration: "15m"
- url: /(.+)
static_files: _site/\1/index.html
upload: _site/(.+)/index.html
expiration: "15m"
- url: /(.*)
static_files: _site/\1
upload: _site/(.*)
#- url: /((tags)|(archive)|(about)|(posts)|(fonts))/
libraries:
- name: webapp2
version: "2.5.2"
see example for clarification

Google AppEngine Yaml PHP Handler Issue

Really simple setup; I just want to access any php file from the api folder (technically would like to specifiy /api/.* or something along that lines to include any subfolders) but this setup only returns 404; I have a feeling it is completely ignoring this line - url: /api/app/(.+\.php)$ because if I type asdfasdf.appspot.com/api/app/main.php (there is a main.php in the root directory) it loads. So this tells me it is staying in the root path the whole time. Any suggestions?
application: fsfhakjsldhf9
version: 1
runtime: php55
api_version: 1
threadsafe: yes
env_variables:
MYSQL_DSN: mysql:unix_socket=/cloudsql/fudfsy9:us-central1:fuasdfe-prod1;dbname=f25dsfss9
MYSQL_USERNAME: fddadfs
MYSQL_PASSWORD: 'asfdasdff'
MYSQL_DATABASE: 'asdfasdf'
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /files
static_dir: files
- url: /api/app/(.+\.php)$
script: \1
secure: always
- url: /.*
script: main.php
The - url: /api/app/(.+\.php)$ also needed script: /api/app/\1 to match

Resources