gcloud app deploy fails with only [ERROR] - google-app-engine

I've been running python 2.7 apps on GCP for about 5 years and deploying using the App Engine Launcher.
Now that AEL is deprecated I'm trying to deploy via gcloud and get "ERROR: (gcloud.app.deploy)"
I can use gcloud to run the project locally so I have confidence that the project is setup correctly and in the right directory locally.
I ran gcloud auth login to give myself permission to upload to the project.
But when I try to redeploy my app I get an error:
DEBUG: Running gcloud.app.deploy with Namespace(__calliope_internal_deepest_parser=ArgumentParser(prog='gcloud.app.deploy', usage=None, description='Deploy the local code and/or configuration of your app to App Engine.', version=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=False), account=None, authority_selector=None, authorization_token_file=None, bucket=None, calliope_command=<googlecloudsdk.calliope.backend.Command object at 0x037D1F90>, command_path=['gcloud', 'app', 'deploy'], configuration=None, credential_file_override=None, deployables=[], docker_build=None, document=None, flatten=None, format=None, h=None, help=None, http_timeout=None, ignore_bad_certs=False, image_url=None, log_http=None, project='MY_PROJECT', promote=None, quiet=None, server=None, skip_image_url_validation=False, skip_staging=False, stop_previous_version=None, trace_email=None, trace_log=None, trace_token=None, user_output_enabled=None, verbosity='debug', version=None).
DEBUG: API endpoint: [https://appengine.googleapis.com/], API version: [v1beta5]
You are creating an app for project [MY_PROJECT].
WARNING: Creating an app for a project is irreversible.
DEBUG: (gcloud.app.deploy)
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 740, in Execute
resources = args.calliope_command.Run(cli=self, args=args)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 1684, in Run
resources = command_instance.Run(args)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\app\deploy.py", line 53, in Run
return deploy_util.RunDeploy(args)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 374, in RunDeploy
app = _PossiblyCreateApp(api_client, project)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 507, in _PossiblyCreateApp
create_util.CreateAppInteractively(api_client, project)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\create_util.py", line 109, in CreateAppInteractively
all_regions = sorted(set(api_client.ListRegions()))
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\app\appengine_api_client.py", line 415, in ListRegions
self.client.apps_locations.List, request)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\app\api\requests.py", line 67, in MakeRequest
raise err() if err else exc
NotFoundError
ERROR: (gcloud.app.deploy)
It doesn't give me much to go on. Wondering if it is a problem with app.yaml or some other basic issue.
gcloud info
Google Cloud SDK [138.0.0]
Platform: [Windows, x86_64]
Python Version: [2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]]
Python Location: [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe]
Site Packages: [Disabled]
Installation Root: [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk]
Installed Components:
bundled-python: [2.7.10]
app-engine-python: [1.9.49]
bq-win: [2.0.24]
core: [2016.12.09]
core-win: [2016.11.07]
gcloud: []
windows-ssh-tools: [2016.05.13]
app-engine-python-extras: [1.9.49]
gsutil: [4.22]
bq: [2.0.24]
powershell: [1.0.0.1]
gsutil-win: [4.20]
System PATH: [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\..\bin\sdk;C:\Users\Jay-swtchbk\Miniconda2\condabin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\WINDOWS\System32\OpenSSH\;C:\Users\Jay-swtchbk\AppData\Roaming\Dashlane\4.6.5.21982\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Users\Jay-swtchbk\AppData\Local\Microsoft\WindowsApps;C:\Users\Jay-swtchbk\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files (x86)\Google\google_appengine\]
Cloud SDK on PATH: [True]
Kubectl on PATH: [False]
WARNING: There are old versions of the Google Cloud Platform tools on your system PATH.
C:\Users\Jay-swtchbk\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd
C:\Users\Jay-swtchbk\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\dev_appserver.py
C:\Program Files (x86)\Google\google_appengine\dev_appserver.py
C:\Users\Jay-swtchbk\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\gsutil.cmd
C:\Users\Jay-swtchbk\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\git-credential-gcloud.cmd
C:\Users\Jay-swtchbk\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\bq.cmd
C:\Users\Jay-swtchbk\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\gcloud-ps.ps1
C:\Users\Jay-swtchbk\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\gsutil-ps.ps1
C:\Users\Jay-swtchbk\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\bq-ps.ps1
C:\Program Files (x86)\Google\google_appengine\endpointscfg.py
C:\Users\Jay-swtchbk\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\endpointscfg.py
Installation Properties: [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\properties]
User Config Directory: [C:\Users\Jay-swtchbk\AppData\Roaming\gcloud]
Active Configuration Name: [tvpub1]
Active Configuration Path: [C:\Users\Jay-swtchbk\AppData\Roaming\gcloud\configurations\config_tvpub1]
Account: [*******#gmail.com]
Project: [MY_PROJECT]
Current Properties:
[core]
project: [MY_PROJECT]
account: [******#gmail.com]
disable_usage_reporting: [False]
app.yaml contents:
runtime: python27
api_version: 1
threadsafe: false
libraries:
- name: jinja2
version: latest
- name: webapp2
version: latest
- name: lxml
version: latest
- name: numpy
version: "1.6.1"
builtins:
- remote_api: on
inbound_services:
- mail
handlers:
- url: /assets
static_dir: assets
- url: /static
static_dir: static
- url: /admin/.*
script: MY_PROJECT.app
login: admin
- url: /favicon\.ico
static_files: assets/img/favicon.ico
upload: assets/img/favicon\.ico
- url: /.*
script: MY_PROJECT.app```

Solved, for those who having similar issues:
I Was using:
gcloud app deploy --project=MY_PROJECT
But it works if you specify the version flag (which is optional according to Google's documentation)
gcloud app deploy --project=MY_PROJECT --version=1

Related

invalid ELF header in Apache Beam python module on Google Cloud

I'm encountering an issue when trying to run a simple BigQuery ETL pipeline with a flask app on Google App Engine in the flex environment.
It works when I run it locally, which I do by first starting it with flask run or gunicorn -b :$PORT main:app and then going to an endpoint in my browser, doing stuff on the page, and submitting a form. The POST handler for the page then invokes the Apache Beam pipeline. All of that works fine.
But when I deploy it with gcloud app deploy and try to access any endpoint I get a 502 error and the logs show the following:
2018-10-04 14:03:39 default[20181003t232620] Traceback (most recent call last): File "/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker worker.init_process() File "/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 129, in init_process self.load_wsgi() File "/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi self.wsgi = self.app.wsgi() File "/env/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load return self.load_wsgiapp() File "/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp return util.import_app(self.app_uri) File "/env/local/lib/python2.7/site-packages/gunicorn/util.py", line 350, in import_app __import__(module) File "/home/vmagent/app/main.py", line 15, in <module> import rw_bigquery_etl File "/home/vmagent/app/rw_bigquery_etl.py", line 9, in <module> import apache_beam as beam File "lib/apache_beam/__init__.py", line 88, in <module> from apache_beam import coders File "lib/apache_beam/coders/__init__.py", line 19, in <module> from apache_beam.coders.coders import * File "lib/apache_beam/coders/coders.py", line 30, in <module> from apache_beam.coders import coder_impl ImportError: lib/apache_beam/coders/coder_impl.so: invalid ELF header
2018-10-04 14:03:39 default[20181003t232620] [2018-10-04 14:03:39 +0000] [8] [INFO] Worker exiting (pid: 8)
2018-10-04 14:03:39 default[20181003t232620] [2018-10-04 14:03:39 +0000] [1] [INFO] Shutting down: Master
2018-10-04 14:03:39 default[20181003t232620] [2018-10-04 14:03:39 +0000] [1] [INFO] Reason: Worker failed to boot.
With the actual error being from apache_beam.coders import coder_impl ImportError: lib/apache_beam/coders/coder_impl.so: invalid ELF header
I had lots of issues with dependencies recently, so I just ran pip freeze > requirements.txt in the project folder, giving me this (pastebin). I've installed this to a lib folder in the project folder and have the line
vendor.add('lib') in appengine_config.py. Also, this is my app.yaml:
runtime: python
api_version: 1
threadsafe: true
env: flex
entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 2
handlers:
- url: /.*
script: main.app
login: required
How can I resolve this issue, or go about troubleshooting it?
I'm new to Google Cloud and pip, so I'm still trying to understand how the cloud environment works, especially with python packages.
Consolidating python dependencies/requirements for apache beam is uniquely frustrating.
It would be helpful to see your
pipeline config
how you launch your pipeline locally
how you launch your pipeline remotely (your request handler code that launches it)
where your pipeline code sits relative to your project root
But it sounds like that requirements.txt you set up is the requirements.txt for your gae flex instance but not getting used for your dataflow worker. Possibly you supplied your requirements.txt as a commandline option when running locally and your server code is not supplying that same option.
Look at my answer here:
https://stackoverflow.com/a/51312281/4458510
I've had the best luck using a setup.py for my pipeline's dependencies, like they do in this example: https://github.com/apache/beam/tree/master/sdks/python/apache_beam/examples/complete/juliaset

dev_appserver.py issue with cloud endpoints framework and grpcio

When attempting to pull in the grpcio library along with Cloud Endpoints Framework, it causes an error when running it through dev_appserver.py. When these changes are pushed to Google Cloud Platform App Engine the error does not present itself.
I have tried changing the versions of google-endpoints, grpcio, and six, but none of the combinations resolved the error. I have run into the error on both Windows and Ubuntu.
Error
Traceback (most recent call last):
File "C:\Users\jwesley\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Users\jwesley\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Users\jwesley\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "C:\Users\jwesley\code_store\gcp_python_sample\python-docs-samples\appengine\standard\endpoints-frameworks-v2\echo\main.py", line 19, in <module>
import endpoints
File "C:\Users\jwesley\code_store\gcp_python_sample\python-docs-samples\appengine\standard\endpoints-frameworks-v2\echo\lib\endpoints\__init__.py", line 27, in <module>
from .apiserving import *
File "C:\Users\jwesley\code_store\gcp_python_sample\python-docs-samples\appengine\standard\endpoints-frameworks-v2\echo\lib\endpoints\apiserving.py", line 76, in <module>
from endpoints_management.control import client as control_client
File "C:\Users\jwesley\code_store\gcp_python_sample\python-docs-samples\appengine\standard\endpoints-frameworks-v2\echo\lib\endpoints_management\__init__.py", line 17, in <module>
from . import auth, config, control, gen
File "C:\Users\jwesley\code_store\gcp_python_sample\python-docs-samples\appengine\standard\endpoints-frameworks-v2\echo\lib\endpoints_management\control\__init__.py", line 19, in <module>
from ..gen import servicecontrol_v1_messages as sc_messages
File "C:\Users\jwesley\code_store\gcp_python_sample\python-docs-samples\appengine\standard\endpoints-frameworks-v2\echo\lib\endpoints_management\gen\servicecontrol_v1_messages.py", line 23, in <module>
from apitools.base.py import encoding
File "C:\Users\jwesley\code_store\gcp_python_sample\python-docs-samples\appengine\standard\endpoints-frameworks-v2\echo\lib\apitools\base\py\__init__.py", line 21, in <module>
from apitools.base.py.base_api import *
File "C:\Users\jwesley\code_store\gcp_python_sample\python-docs-samples\appengine\standard\endpoints-frameworks-v2\echo\lib\apitools\base\py\base_api.py", line 27, in <module>
from six.moves import http_client
ImportError: No module named moves
Recreating the issue
Make sure you have Google Cloud SDK installed.
Clone the python-docs-samples repository:
https://github.com/GoogleCloudPlatform/python-docs-samples.git
Navigate into echo sample
cd python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo
Start dev_appserver
dev_appserver.py app.yaml
Send a POST test to make sure it works.
curl -d '{"content":"time"}' -H "Content-Type: application/json" -X POST http://localhost:8080/_ah/api/echo/v1/echo
With the echo application working, now install grpcio with the version GCP uses.
pip install grpcio==1.0.0
Edit the app.yaml file to include the grpcio library, so your file will look like this.
runtime: python27
threadsafe: true
api_version: 1
basic_scaling:
max_instances: 2
#[START_EXCLUDE]
skip_files:
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
- ^(.*/)?setuptools/script \(dev\).tmpl$
#[END_EXCLUDE]
handlers:
# The endpoints handler must be mapped to /_ah/api.
- url: /_ah/api/.*
script: main.api
libraries:
- name: pycrypto
version: 2.6
- name: ssl
version: 2.7.11
- name: grpcio
version: "latest"
# [START env_vars]
env_variables:
# The following values are to be replaced by information from the output of
# 'gcloud endpoints services deploy swagger.json' command.
ENDPOINTS_SERVICE_NAME: YOUR-PROJECT-ID.appspot.com
ENDPOINTS_SERVICE_VERSION: 2016-08-01r0
# [END env_vars]
Start dev_appserver.py again.
dev_appserver.py app.yaml
Send the POST again.
curl -d '{"content":"time"}' -H "Content-Type: application/json" -X POST http://localhost:8080/_ah/api/echo/v1/echo
The error I placed above should show up in the output of the dev_appserver.py.

Couldn't connect to the Docker daemon due to an SSL

I'm trying to deploy Managed VM (Python) on Google App / Compute Engine with command:
gcloud --verbosity debug preview app deploy ./app.yaml --set-default
during deployment VM instance is created but it exits on error (here is paste of last few lines of listing):
DEBUG: Display disabled.
Copying certificates for secure access. You may be prompted to create an SSH keypair.
DEBUG: Loaded Command Group: ['gcloud', 'compute', 'copy_files']
DEBUG: Detected docker environment variables: DOCKER_HOST=tcp://104.197.50.238:2376, DOCKER_CERT_PATH=../../../../../tmp/tmpPbKmOs, DOCKER_TLS_VERIFY=True
INFO: Starting new HTTPS connection (1): 104.197.50.238
DEBUG: Failed to connect to Docker daemon due to an SSL problem: [Errno 1] _ssl.c:523: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: (gcloud.preview.app.deploy) Couldn't connect to the Docker daemon due to an SSL problem.
Traceback (most recent call last):
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 591, in Execute
result = args.cmd_func(cli=self, args=args)
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 1191, in Run
resources = command_instance.Run(args)
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/appengine/app_commands/deploy.py", line 208, in Run
implicit_remote_build)
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/deploy_command_util.py", line 137, in BuildAndPushDockerImages
with docker_util.DockerHost(cli, version_id, remote) as docker_client:
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/docker_util.py", line 215, in __enter__
return containers.NewDockerClient(local=(not self._remote), **kwargs)
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/docker/containers.py", line 313, in NewDockerClient
'Couldn\'t connect to the Docker daemon due to an SSL problem.' + msg)
DockerDaemonConnectionError: Couldn't connect to the Docker daemon due to an SSL problem.
ERROR: (gcloud.preview.app.deploy) Couldn't connect to the Docker daemon due to an SSL problem.
apparently there is problem with SSL but I have no idea how to solve it, and I'm quite desperate at the moment :)
I have:
Docker version 1.8.2, build 0a8c2e3
Boot2Docker-cli version: v1.8.0 Git commit: 9a26066
Google Cloud SDK 0.9.79
app 2015.09.23
app-engine-java 1.9.26
app-engine-python 1.9.26
bq 2.0.18
bq-nix 2.0.18
core 2015.09.23
core-nix 2015.09.03
gcloud 2015.09.21
gsutil 4.15
gsutil-nix 4.14
preview 2015.09.21
OpenSuse 13.2
OpenSSL 1.0.1k-fips 8 Jan 2015
I would very much appreciate help of any kind.
EDIT:
app.yaml
module: default
runtime: python27
api_version: 1
threadsafe: yes
vm: true
resources:
cpu: .5
memory_gb: 1.3
manual_scaling:
instances: 1
handlers:
- url: .*
script: main.app
Are you using homebrew Python on OS X? If so, there's an existing bug for OpenSSL and Docker here.
The easiest way around this is to temporary use a virtualenv with system python.
pip install virtualenv
virtualenv ~/system-python-env
source ~/system-python-env
gcloud preview app deploy ...
You can get at a short-lived SSL with "gcloud docker --authorize-only". Then immediately do your "gcloud preview app deploy..".
gcloud docker --authorize-only
gcloud preview app deploy app.yaml --promote

Google App Engine Managed VMs for Go: AttributeError: 'module' object has no attribute 'CleanableContainerName'

On a Mac OS X, trying to turn on the debug flag or to run the hello world test project for Go Managed VMs, I am getting the following error: AttributeError: 'module' object has no attribute 'CleanableContainerName'
Any ideas?
Full error log:
orcaman$ $(boot2docker shellinit)
Writing /Users/orcaman/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/orcaman/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/orcaman/.boot2docker/certs/boot2docker-vm/key.pem
orcaman$ gcloud --verbosity debug preview app setup-managed-vms
DEBUG: Running gcloud.preview.app.setup-managed-vms with _Args({'base_image_bucket': 'containers-prod',
'docker_host': None,
'format': None,
'h': None,
'help': None,
'image_version': 'latest',
'markdown': None,
'project': None,
'quiet': None,
'shell': None,
'user_output_enabled': None,
'verbosity': 'debug'}).
DEBUG: Detected docker environment variables: DOCKER_HOST=tcp://192.168.59.103:2376, DOCKER_CERT_PATH=/Users/orcaman/.boot2docker/certs/boot2docker-vm, DOCKER_TLS_VERIFY=1
INFO: Starting new HTTPS connection (1): 192.168.59.103
DEBUG: "GET /v1.10/_ping HTTP/1.1" 200 2
INFO: Looking for image_id for image with tag google/docker-registry
DEBUG: "GET /v1.10/images/json?filter=google%2Fdocker-registry&only_ids=1&all=0 HTTP/1.1" 200 253
DEBUG: Found Cloud SDK root: /Users/orcaman/google-cloud-sdk
Select the runtime to download the base image for:
[1] Go
[2] Java
[3] Python27
[4] All
Please enter your numeric choice (4): 1
DEBUG: Detected docker environment variables: DOCKER_HOST=tcp://192.168.59.103:2376, DOCKER_CERT_PATH=/Users/orcaman/.boot2docker/certs/boot2docker-vm, DOCKER_TLS_VERIFY=1
INFO: Starting new HTTPS connection (1): 192.168.59.103
DEBUG: "GET /v1.10/_ping HTTP/1.1" 200 2
Pulling base images for runtimes [go] from Google Cloud Storage
INFO: Refreshing access_token
DEBUG: Copy /Users/orcaman/.config/gcloud/legacy_credentials/orhiltch#gmail.com/.boto to /var/folders/dv/g8_pdljx49gdtbs25_1ch7vm0000gn/T/tmp7imPhg...
DEBUG: Copy /Users/orcaman/google-cloud-sdk/docker/true-asm to /var/folders/dv/g8_pdljx49gdtbs25_1ch7vm0000gn/T/tmp7imPhg...
Traceback (most recent call last):
File "/Users/orcaman/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 177, in <module>
main()
File "/Users/orcaman/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 173, in main
_cli.Execute()
File "/Users/orcaman/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 409, in Execute
post_run_hooks=self.__post_run_hooks, kwargs=kwargs)
File "/Users/orcaman/google-cloud-sdk/./lib/googlecloudsdk/calliope/frontend.py", line 274, in _Execute
pre_run_hooks=pre_run_hooks, post_run_hooks=post_run_hooks)
File "/Users/orcaman/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 928, in Run
result = command_instance.Run(args)
File "/Users/orcaman/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/setup_managed_vms.py", line 39, in Run
args.image_version)
File "/Users/orcaman/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/pull.py", line 54, in PullBaseDockerImages
util.PullSpecifiedImages(docker_client, image_names, version, bucket)
File "/Users/orcaman/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/util.py", line 217, in PullSpecifiedImages
with credentials.CredentialsContainer(docker_client) as creds, (
File "/Users/orcaman/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/credentials.py", line 114, in __enter__
self.Start()
File "/Users/orcaman/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/credentials.py", line 95, in Start
name=containers.CleanableContainerName(
AttributeError: 'module' object has no attribute 'CleanableContainerName'
Docker/Boot2docker version:
bash-3.2$ docker version
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8
OS/Arch (client): darwin/amd64
Server version: 1.4.1
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 5bc2ff8
gcloud version:
gcloud version
Google Cloud SDK 0.9.42
app 2015.01.06
app-engine-go-darwin-x86_64 1.9.17
app-engine-java 1.9.17
app-engine-managed-vms 2014.11.03
app-engine-python 1.9.17
bq 2.0.18
bq-nix 2.0.18
compute 2015.01.06
core 2015.01.06
core-nix 2014.10.20
dns 2015.01.06
gcutil 1.16.5
gcutil-nix 1.16.5
gsutil 4.7
gsutil-nix 4.6
preview 2015.01.06
preview-extensions-darwin-x86_64 0.7.0
sql 2015.01.06
UPDATE:
The fix for gcloud is now available in the latest version and this issue should be resolved.
Previous Post:
As a temporary workaround you can run:
gcloud components restore
There may be a bug in the latest gcloud update. I saw the same error after updating - but is working now after running the above command.

Appengine application not working when deployed - TemplateNotFound. It works on localhost

I am facing same issue with google app engine application. It works on SDK (localhost), not working when uploaded to appengine. Deployment was successful. I am stuck on this!!! Any help appreciated.
Traceback logs below:
Traceback (most recent call last):
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~cloud-chess/1.368562751153844474/chessboard.py", line 29, in get
template = JINJA_ENVIRONMENT.get_template('files/html/chess.html')
File "/python27_runtime/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py", line 719, in get_template
return self._load_template(name, self.make_globals(globals))
File "/python27_runtime/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py", line 693, in _load_template
template = self.loader.load(self, name, globals)
File "/python27_runtime/python27_lib/versions/third_party/jinja2-2.6/jinja2/loaders.py", line 115, in load
source, filename, uptodate = self.get_source(environment, name)
File "/python27_runtime/python27_lib/versions/third_party/jinja2-2.6/jinja2/loaders.py", line 180, in get_source
raise TemplateNotFound(template)
TemplateNotFound: files/html/chess.html
Deployment Logs:
01:56 PM Host: appengine.google.com
01:56 PM Application: cloud-chess; version: 2
01:56 PM
Starting update of app: cloud-chess, version: 2
01:56 PM Getting current resource limits.
Password for xxxx.pk#gmail.com: 01:56 PM Scanning files on local disk.
01:56 PM Cloning 17 static files.
01:56 PM Cloning 3 application files.
01:56 PM Uploading 1 files and blobs.
01:56 PM Uploaded 1 files and blobs
01:56 PM Compilation starting.
01:57 PM Compilation completed.
01:57 PM Starting deployment.
01:57 PM Checking if deployment succeeded.
01:57 PM Deployment successful.
01:57 PM Checking if updated app version is serving.
01:57 PM Completed update of app: cloud-chess, version: 2
01:57 PM Uploading index definitions.
2013-07-07 13:57:18 (Process exited with code 0)
chessboard.py
import os
import webapp2
import jinja2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'])
class MainHandler(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('files/html/chess.html')
self.response.write(template.render())
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
app.yaml
application: cloud-chess
version: 2
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /html
static_dir: files/html/
- url: /images
static_dir: files/images/
- url: /scripts
static_dir: files/scripts/
- url: .*
script: chessboard.app
libraries:
- name: webapp2
version: "2.5.2"
- name: jinja2
version: latest
Your problem is that the templates your are trying to load are residing in your static directive html .
There is no need to deploy templates as static resources - in fact you probably shouldn't.
When you deploy static resources they are not normally readable by your application.
Recently an app.yaml directive was added to allow you to read these resources.
Unless there is html files you wish to statically serve, just drop the /html static directive, or move your templates somewhere else.
or add the directive. application_readable to the /html static handler
see the docs for static handlers https://developers.google.com/appengine/docs/python/config/appconfig#Static_Directory_Handlers
Personally I would recommend against being able to statically serve jinja templates as well use them for rendering.
Why does this work in the dev environment - the dev environment doesn't use different storage mechanisms for serving static and application readable resources.
You can't store your templates in a static directory.
Simply remove the /html handler from app.yaml like so:
application: cloud-chess
version: 2
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /images
static_dir: files/images/
- url: /scripts
static_dir: files/scripts/
- url: .*
script: chessboard.app
libraries:
- name: webapp2
version: "2.5.2"
- name: jinja2
version: latest

Resources