I can't deploy a simple Flask/MySQL application on the Python standard environment; it times out.
ERROR: (gcloud.app.deploy) Error Response: [4] Cloud build did not succeed within 10m.
In the logs it says this:
Step #7 - "exporter": Layer 'google.python.appengine:config' SHA: sha256:c7053ac3e...
TIMEOUT
ERROR: context deadline exceeded
This is app.yaml (appropriately censored):
runtime: python37
instance_class: F2
handlers:
- url: /static
static_dir: static
- url: /.*
script: auto
env_variables:
GAE_USE_SOCKETS_HTTPLIB: True
DB_USER: XXXX
DB_PASS: XXXX
DB_NAME: XXXXXXXX
CLOUD_SQL_CONNECTION_NAME:XXXXXXXXXXX:us-west3:XXXXXXXXXXX
This is requirements.txt:
numpy==1.19.0
Flask==1.1.2
googleads>=24.0.0
SQLAlchemy==1.3.17
PyMySQL==0.9.3
google-search-results==1.8.3
I've tried all kinds of things but nothing works. This used to run with no problems; we haven't changed anything. It's basically a Hello World Flask app.
Related
Upon moving my projects files to a new computer, I can no longer deploy to Google App Engine. I don't know how to deciper the error, and my Google searches turn up nothing. Here is what gets returned:
File upload done.
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build ca8b6f48-9892-449a-a6d8-b220182e8d7c status: FAILURE
Error ID: 4daa946e
Error type: UNKNOWN
Error message: go build: cannot write multiple packages to non-directory /layers/google.go.build/bin/main
Full build logs: https://console.cloud.google.com/cloud-build/builds/[build log address]
The project builds fine on my local machine. I'm not sure what I'm doing wrong here.
The app.yaml looks like this:
runtime: go114
instance_class: F1
env_variables:
BUCKET_NAME: "****.appspot.com"
handlers:
- url: /robots.txt
static_files: robots.txt
upload: robots.txt
- url: /styles
static_dir: styles
secure: always
- url: /scripts
static_dir: scripts
secure: always
- url: /.*
script: auto
secure: always
Thanks for any clues!
I just started receiving this error message when deploying with gcloud app deploy, resulting in a failed deployment.
My yaml file does have runtime_config: document_root defined, and I have successfully deployed countless times before.
This is the error message I'm seeing:
Step #1: Digest: ...
Step #1: Status: Downloaded newer image for
gcr.io/gcp-runtimes/php/gen-dockerfile#sha256:26c300e0afd68577f9bd3f2565bd690379ed797b74eed8517cc93e86f2c1be5a
Step #1: gcr.io/gcp-runtimes/php/gen-dockerfile#sha256:26c300e0afd68577f9bd3f2565bd690379ed797b74eed8517cc93e86f2c1be5a
Step #1: + php /builder/create_dockerfile.php create --php72-image
gcr.io/google-appengine/php72#sha256:6255560e92bfff2d4debc198156bdbeeefccf97b4f315c84c5e6bc03387dc6f7
--php71-image gcr.io/google-appengine/php71#sha256:ea560b34d5da1e51aca89373ee90e2c67637fd141914d582753927e9d05f5d11
--php70-image gcr.io/google-appengine/php70#sha256:84b209e24bf340e3afbadde366ddb6c20d6879fe513bf600fc5a440767363917
--php56-image gcr.io/google-appengine/php56#sha256:8cd9595ab8672c906c029d58276ec5547d34e2781e278f6af0715ca8ac15bab1
Step #1: Step #1: In GenFilesCommand.php line 297: Step #1:
Step #1: You have to set document_root in the runtime_config section
in app.yaml. Step #1:
Step #1: Step #1: create [--php72-image PHP72-IMAGE] [--php71-image
PHP71-IMAGE] [--php70-image PHP70-IMAGE] [--php56-image PHP56-IMAGE]
[-w|--workspace WORKSPACE] Step #1: Finished Step #1 ERROR ERROR:
build step 1
"gcr.io/gcp-runtimes/php/gen-dockerfile#..."
failed: exit status 1
Updating service [...] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build
... status: FAILURE.
Build error details: Build error details not available..
Contents of my yaml configuration:
runtime: php
runtime_config:
document_root: wordpress
nginx_conf_include: nginx-app.conf
env: flex
api_version: 1
service: SERVICE_ID
threadsafe: true
automatic_scaling:
min_num_instances: 1
max_num_instances: 10
resources:
cpu: 4
memory_gb: 12
disk_size_gb: 10
beta_settings:
cloud_sql_instances: REDACTED
handlers:
- url: /(.*\.(htm|html|css|js|scss|map))
static_files: wordpress/\1
upload: wordpress/.*\.(htm|html|css|js|scss|map)$
application_readable: true
secure: always
- url: /(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
static_files: wordpress/\1
upload: wordpress/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$
application_readable: true
secure: always
- url: /(.*\.php)
script: wordpress/index.php
secure: always
skip_files:
- ^.sass-cache
- ^.git
- ^.log
- .sass-cache/
- .git/
- ^vendor
- ^node_modules
- ^wonolog
env_variables:
WHITELIST_FUNCTIONS: escapeshellarg,escapeshellcmd,exec,pclose,popen,shell_exec,phpversion,php_uname
It has been confirmed by the Google App Engine Team that this was an issue from their side, which prevented a custom-named yaml file from being deployed.
The App Engine Team has advised that this issue was due to a change on
our side that prevented flex builds. That change was rolled back.
I want to create very standard setup for GAE (php runtime): 2 modules with specific URLs (routings):
module-api for REST API
module-oli for backend static process ..
regarding to doc (https://cloud.google.com/appengine/docs/php/modules/ and https://cloud.google.com/appengine/docs/php/modules/routing) I've created 3 .yaml config files:
dispatch.yaml
application: ABC
dispatch:
- url: "*/oli/*"
module: module-oli
- url: "*/"
module: module-api
app.yaml
application: ABC
version: v1
module: module-api
runtime: php55
api_version: 1
handlers:
- url: /.*
script: public/api.php
module-oli.yaml
application: ABC
version: v1
module: module-oli
runtime: php55
api_version: 1
manual_scaling:
instances: 1
handlers:
- url: /.*
script: public/oli.php
I also tried many changes in URL handling, but the error I always get is "Duplicate module: module-api".
Can you help me please? Thank you in advance ..
I have no idea why, but (on my computer) it does not work just from googleAppEngineLauncher.app (OSX 10.11.3, googleAppEngineLauncher version 1.9.32), but it works if I use command line tools:
dev_appserver.py app.yaml module-oli.yaml
and only if I do not use param --skip_sdk_update_check (does not matter value)
more about naming modules (and using default module or not) .. it all works even if I name default module with specific name (of course, it causes error when not all request are dispatched to the module).
more about dispatching to modules; it works (as it's documented here). of course, it does not work at local development environment, as every single module runs at a different port (than the dispatch does not work, and if there is a module with manual_scaling, the _ah/start can not be handled and as err500 it stops the start)
here are all setup files, and how to run it:
app.yaml
application: <APPLICATION-ID>
module: default
version: v1
runtime: php55
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: .*
script: blablabla.php
module-oli.yaml
application: <APPLICATION-ID>
version: v1
module: module-oli
runtime: php55
api_version: 1
threadsafe: yes
instance_class: B1
manual_scaling:
instances: 1
handlers:
- url: /oli/.*
script: blebleble-oli.php
dispatch.yaml
dispatch:
- url: "*/oli/*"
module: module-oli
- url: "*/*"
module: default
to run on local development environment: dev_appserver.py app.yaml module-oli.yaml .. (no automatic routing, instances are running on different ports)
one everything is deployed to gcloud and dispatching is updated (appcfg.py -A wellfedcat-1221 update_dispatch .), it works like this:
APPLICATION-ID.appspot.com/* : served by default module ..
APPLICATION-ID.appspot.com/oli/* : served by module-oli ..
the dispatching is necessary when you want to use our own domain to map to gcloud ..
thank you #Tom for help!
Problem fixed via Google Cloud support:
I removed the /_ah/spi/* handler from my endpoints yaml file, and the
- url: /.*
script: api.app
did not instantiate the endpoint.
It used to work before since the API was deployed for the previous version, but with the new version, there was nothing explicit to deploy the endopoints. So handlers need to be
handlers:
- url: /_ah/spi/.*
script: api.app
- url: /.*
script: api.app
Keeping the issue below for reference purposes
I've just deployed a new version of my application, and calls to http://app.appspot.com/_ah/api/app/version/method now return a 404. It worked perfectly before the update.
However, there's no trace at all in the logs, and no instance launched when I call/ping those URIs.
While if I call /_ah/whatever/app/version/method, I still have a 404, but it appears in my module logs, and it has the following message
{"state": "APPLICATION_ERROR", "error_message": "Not Found"}
The app is configured using modules, my app.yaml is defined with
application: appname
version: 2015-04-07
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /_ah/spi/.*
script: api.api.app
- url: /.*
script: www.www.app
secure: always
libraries:
- name: pycrypto
version: latest
- name: endpoints
version: 1.0
- name: webapp2
version: latest
- name: jinja2
version: latest
And, in api/api.yaml
application: appname
module: default
version: 2015-04-07
runtime: python27
api_version: 1
threadsafe: true
inbound_services:
- warmup
handlers:
- url: /.*
script: api.app
libraries:
- name: pycrypto
version: latest
- name: endpoints
version: 1.0
- name: ssl
version: latest
I've updated the app to serve this new version in the admin console, and all other modules work perfectly.
Also, I can't see my API in the API explorer, https://appname.appspot.com/_ah/api/explorer returns an empty list (while I see it when running the dev server on localhost).
Update: I've just noticed, looking at #bossylobster reply in GAE cloud endpoints - Api not updating after deploy, that I do not have "Successfully updated API configuration" in my logs after the "Completed update of a new alternate version". However, I have "API deletion serving" at about the time everything started to be 404. Yet, I have no idea why there's this API deletion query in my logs. Any idea of what can be wrong?
That's an app in production and so the mobile version is down at the moment. I'm happy to send the app ID to a devrel in PM if that helps.
I am using App Engine Modules in my python project. (https://developers.google.com/appengine/docs/python/modules/#Python_Background_threads)
I am also receiving email in m project:
https://developers.google.com/appengine/docs/python/mail/receivingmail
I want to direct the emails to my worker module and not the default module. To that end my worker.yaml has the following settings
worker.yaml
api_version: 1
application: integrate
module: worker
version: 1-0-0
runtime: python27
threadsafe: true
inbound_services:
- mail
builtins:
- deferred: on
handlers:
- url: /admin/.+
script: src.worker.main.app
login: admin
- url: /_ah/mail/.+
script: src.worker.main.app
login: admin
- url: /.*
script: src.worker.main.app
app.yaml
api_version: 1
application: integrate
version: 1-0-0
runtime: python27
threadsafe: true
builtins:
- deferred: on
handlers:
- url: /admin/.+
script: src.default.main.app
login: admin
- url: /.*
script: src.default.main.app
I even tried adding a dispatch.yaml
application: integrate
dispatch:
- url: "*/_ah/mail/.+"
module: worker
But no matter what I do the emails which reach my app are handled by the default module. Any idea what I am missing here? I see the emails coming in but no matter what I do they only go to the default module.
Inbound services could be used only within default module and that is expected behavior. The fact that it works for you locally in devserver is a bug, actually.
Just some additional info for the answer which may help folks in a similar situation.
I noticed in the DevServer log:
"Skipping dispatch.yaml rules because /_ah/mail/[EMAIL_ADDRESS_FOR_APP] is not a dispatchable path."
This is no doubt due to local config, however.
Regardless, the workaround I have now using Tasks is:
Dispatch or directly handle Inbound Mail in the default module
Provide a script handler that creates a Task, taking the relevant MailMessage data as the payload
Set the TaskQueue in queue.yaml to target the module you wish to process the payload data, e.g. a 'worker' module