I have been looking for a great way to deploy my Django application and I found Google App Engine Flex a pretty good solution. I have not much experience in application deployment so I follow along with the Official Google Tutorial about the deployment.
On the last step, the tutorial instructs me to deploy the application within the cmd prompt: gcloud app deploy.
I follow along. Everything seems fine until I get this message:
Updating service [default] (this may take several minutes)...
After a while I get this message:
Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [13] Flex operation <stuff..> error [INTERNAL]: An internal error occurred while processing task /app-engine-flex/insert_flex_deployment/flex_create_resources>2020-10-10T07:36:04.734Z7747.ue.0: Deployment Manager operation <stuff..> errors: [code: "RESOURCE_ERROR"
location: "<stuff...>"
message: "{\"ResourceType\":\"compute.beta.regionAutoscaler\",\"ResourceErrorCode\":\"403\",\"ResourceErrorMessage\":{\"code\":403,\"message\":\"The caller does not have permission\",\"status\":\"PERMISSION_DENIED\",\"statusMessage\":\"Forbidden\",\"requestPath\":\"<stuff..>",\"httpMethod\":\"POST\"}}"
]
Every time I rerun the command gcloud app deploy I get the exact same error. Any idea how to fix that? Google Search doesn't reveal anything for me.
Firstly try and give the following permissions to yourself. This answer will help with some of the explanations.
Also, try and add the following in your .yaml file and see if it solves it
automatic_scaling:
min_num_instances: 1
max_num_instances: 7
Related
I have a python-based website I'm trying to upload through Heroku (not ideal I know but it's faster than learning JS). the python script is using flask, and when run locally it works fine. i uploaded it to heroku (git, commit etc) but when i try to open the app in the browser (not locally) i get the following message: "An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command"
i checked the logs and i can't find anything wrong.
please help I've been stuck on this for way too long and the heroku support hasn't been much help
Check your logs by using
heroku logs --tail --app your_app_name
and find your errors and then search your error problem in this https://devcenter.heroku.com/articles/error-codes
After following freecampcode's web application tutorial, creating my own Google Cloud SDK project and deploying my sample social network website using Python and Flask (which I found mostly thought this tutorial), I am getting this same error: Internal/Unknown Server Error 500, which looks like:
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
Checking the logs, I get the errors:
-2020-07-06 01:51:29 default[20200705t214944] "GET / HTTP/1.1" 500
-2020-07-06 01:51:32 default[20200705t214944] "GET /favicon.ico HTTP/1.1" 500
Any help would be greatly appreciated. I've been stuck on this issue for a while. If you need additional information on the project, please let me know. This is my first gcloud project.
EDIT: I checked the error logs and saw the error:
ImportError: No module named main
at LoadObject (/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py:85)
at _LoadHandler (/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py:311)
at Handle (/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py:240)
So I added the file main.py with the contents:
from app.wsgi import main as app
entrypoint: gunicorn -b :$PORT app.wsgi:main
and I still get the same internal error.
What I noticed is that tutorial 1 (this one) contain how-to for python2, while the 2nd tutorial (this one) is how-to build with python3.
What more python2 not supported any more, so there is no point to learn how to use it. Here it is the reference.
I suppose you have to change environment in app.yaml file. Here is reference to python3 environment. I would start with that.
What I recommend you as well is to go to Google Cloud Platform and open App Engine (direct link). On the right you have a possibility to go with tutorial called "App Engine Quickstart" or "Hello World". You can choose Python and go trough whole process of creating HelloWorld app, which by the way is Flask as well. I would try it even before the once you are trying.
I hope it will help!
one way is to Try with DEBUG mode off
still if it not works then try this below way with this you will get exact details why you got this error
Try this it will return exact error
#app.errorhandler(500)
def internal_server_error(e):
return jsonify(error=str(e)), 500
GAE will not update the deployed code through gcloud. For instance, I created this method:
main.py
#app.route('/test',methods=['GET'])
def test():
print 'print test'
return 'test'
app.yaml
runtime: python27
api_version: 1
threadsafe: true
runtime_config:
python_version: 2
instance_class: F2
handlers:
- url: /.*
script: main.app
libraries:
- name: flask
version: 0.12
deploy the app:
gcloud app deploy app.yaml queue.yaml --project $PROJECT
Then I get a 404 when visiting /test.
I tracked down the log error:
This request caused a new process to be started for your application,
and thus caused your application code to be loaded for the first time.
This request may thus take longer and use more CPU than a typical
request for your application.
I looked at this article, which noted that I shouldn't be getting the error every time I visit the URL. I do.
I added --verbosity=info to my deployment and everything looked great except:
INFO: Could not find any remote repositories associated with
[path-to-app]. Cloud diagnostic tools may not be able to display the
correct source code for this deployment.
The code appeared updated in the dedugger, which is strange. The latest version is 100% deployed in the App Engine Dashboard.
This is really confusing because on deployment, there isn't a repo, but the code appears in the debugger but the end point won't function because there aren't enough resources.
There seems to be a lot happening here and not sure what the issue is.
Update
Some posts recommend a warmup. I followed the guidelines here and still, no dice. I'm getting a 404 when visiting /test and /_ah/warmup.
This issue could be caused by multiple different reasons, there could be a lot of factors in play, in most cases the error 404 shows when the app.yaml failed to allocate the flask library as the ‘flask’ libraries by default not bundled in the libraries the Google App Engine includes. So it needs to be added manually. One of the way to figure out if the issue is a deployment issue is to go to this link (https://console.cloud.google.com/logs/viewer) and check if there is any logs recorded or not. If there is no log appearing in the viewer it could very well mean that the problem occurred even before it actually knocks the server.
Additionally, I would highly recommend you to go through the following link (https://codelabs.developers.google.com/codelabs/cloud-vision-app-engine/index.html?index=..%2F..%2Findex#0) to deploy flask on the Google Cloud App Engine environment.
Also, I would like to make a suggestion to try a workaround using the ‘webapp2’ library if possible. The link is the following (http://webapp2.readthedocs.io/en/latest/index.html)
I have also noticed there is an attempt to run the queue.yaml. It is important to configure the file accordingly as well.
To summarize, I would really appreciate if you could try all the different possibilities to deploy the flask library and observe the results. Thank you so much.
i create simple hello world app using this tutorial
https://cloud.google.com/appengine/docs/flexible/python/hello-world
and im trying deploy app using console
gcloud config set project [myId]
gcloud config set account xxxx#gmail.com
cloud preview app deploy app.yaml
in the end console write error
Error Response: [13] Timed out when starting VMs. It's possible that
the application code is unhealthy. (0/2 ready, 2 still deploying).
This error means that your application failed to start up correctly ("It's possible that the application code is unhealthy.").
Managed VMs rely on your application responding to "health checks" in order to determine when to send traffic to that version of your application. These "health checks" are an HTTP endpoint that the Managed VM infrastructure will check frequently for an "all good" response.
The getting-started tutorial contains working code, so it's possible that you introduced a typo or error in the file structure. Check http://console.developers.google.com/ and navigate to the "Logging" section to check your application logs for clues as to what the issue might be.
I am following along this tutorial for deploying a Flask app with Docker http://blogs.aws.amazon.com/application-management/post/Tx1ZLAHMVBEDCOC/Dockerizing-a-Python-Web-App
I've got everything working great on local. However when i upload the code to elastic beanstalk and launch the app I get the following errors:
Creating EIP failed Reason: Resource creation cancelled
Creating security group named: xyz failed Reason: Resource creation cancelled
Stack named 'xyz-stack' aborted operation. Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [NewSignupTopic, StartupSignupsTable, AWSEBSecurityGroup, NewSignupQueue, AWSEBEIP]
I've tried modifying my choices in the upload flow -- e.g. not selecting an RDS, selecting a single instance and so on. But these don't seem relevant. Any pointers are greatly appreciated!
.
I've also been following that tutorial and had the exact same problem. For me, it turns out that the user I had associated with the eb CLI did not have the appropriate privileges to create the desired resources. Make sure that you've granted DynamoDB:CreateTable and SNS:CreateTopic permissions to that user.