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.
Related
Been pulling my hair trying to figure out why can't favicon.ico loads properly. Needed help from Google Cloud AppEngine gurus.
The project is a React App where gcp-build will generate a build folder with favicon.ico in it.
Consider the following cloudbuild.yaml:
steps:
- name: node:12
args: ["yarn"]
- name: node:12
args: ["yarn", "gcp-build"]
- name: node:12
args: ["rm", "-rf", "node_modules"]
- name: "gcr.io/cloud-builders/gcloud"
args: ["app", "deploy", "--version=mark0"]
timeout: "1600s"
And app.yaml looks like:
service: react-demo
runtime: nodejs12
handlers:
- url: /favicon.ico
static_files: build/favicon.ico
upload: build/favicon.ico
Hitting the page https://react-demo-dot-xxxx-xxxxx.df.r.appspot.com/favicon.ico will always get a 404 error.
Can anyone help please?
To debug if it's an issue with either the Cloud Build steps, the deployment or the runtime itself (notice that the Nodejs 12 runtime is currently in beta), build the React App locally and try to deploy the application directly by using gcloud app deploy, with the following app.yaml file:
runtime: nodejs10
service: react-demo
handlers:
- url: /static/js/(.*)
static_files: build/static/js/\1
upload: build/static/js/(.*)
- url: /static/css/(.*)
static_files: build/static/css/\1
upload: build/static/css/(.*)
- url: /static/media/(.*)
static_files: build/static/media/\1
upload: build/static/media/(.*)
- url: /(.*\.(json|ico))$
static_files: build/\1
upload: build/.*\.(json|ico)$
- url: /
static_files: build/index.html
upload: build/index.html
- url: /.*
static_files: build/index.html
upload: build/index.html
Turns out that there's a dispatch.yaml deployed unbeknownst to me using CLI and not committed into codes. In that dispatch.yaml it was directing all */favicon.ico towards default service. One lesson that I've learned is to scour for logs, in this instance, there are no 404 errors logged in the supposed service but it was abundant in the logs of the default service.
Hopefully this would help others in troubleshooting.
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...
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
I'm working on porting my blog from GitHub pages to Google App Engine. I've set up my app.yaml as follows.
runtime: python27
api_version: 1
version: 5
threadsafe: yes
handlers:
- url: /api/.*
script: main.app
- url: /
static_files: src/_site/index.html
upload: src/_site/index.html
- url: /(.*)/
static_files: src/_site/\1/index.html
upload: src/_site/*.*
- url: /(.*)
static_files: src/_site/\1
upload: src/_site/(.*)
error_handlers:
- file: static/404.html
You can get to my 404 page directly by going to http://joshuasnidercom.appspot.com/404.html and you can get to by accessing a missing page that the flask app handles like http://joshuasnidercom.appspot.com/api/invalidurl, but going to any page that is covered by the static files like http://joshuasnidercom.appspot.com/nonexistentpage just shows a Error: Not Found The requested URL /nonexistentpage was not found on this server. error.
What should I be doing differently?
I believe you need to create an error handler in your views file.
You can do this with the following code:
#app.errorhandler(404)
def page_not_found(e):
return render_template("404.html"),404
You can also replace 404 with 500, 403, etc,for other errors.
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.