GAE deployment error: "Cannot write multiple packages" - google-app-engine

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!

Related

Why does Google App Engine Standard Edition for Java create a __static__ folder and double the number of files deployed to a project?

I am deploying a web application to Google App Engine Standard edition using Java 8.
It is a documentation web site plus servlets that includes a huge amount of static web content (built with Jekyll).
I recently started getting this error trying to deploy the app:
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: This deployment has too many files.
New versions are limited to 10000 files for this app.
- '#type': type.googleapis.com/google.rpc.BadRequest
fieldViolations:
- description: This deployment has too many files.
New versions are limited to 10000 files for this app.
field: version.deployment.files[...]
My src/main/webapp folder has 5016 files.
But after running:
mvn clean install appengine:stage
my target/appengine-staging folder has 10113 files.
I see that the files are in 2 locations, both
target/appengine-staging
and
target/appengine-staging/__static__
Why do they appear twice?
Is this normal?
Or am I doing something wrong?
How can I avoid this duplication?
Or do I have to limit my files to under 5000?
Thanks for any advice.
Note: The generated app.yaml looks like this:
runtime: java8
instance_class: F1
inbound_services:
- warmup
derived_file_type:
- java_precompiled
threadsafe: True
auto_id_policy: default
beta_settings:
'source_reference': 'https://...'
api_version: 'user_defined'
handlers:
- url: (/.*/)
static_files: __static__\1index.html
upload: __NOT_USED__
require_matching_file: True
login: optional
secure: always
- url: (/)
static_files: __static__\1index.html
upload: __NOT_USED__
require_matching_file: True
login: optional
secure: always
- url: (/.*)
static_files: __static__\1
upload: __NOT_USED__
require_matching_file: True
login: optional
secure: always
- url: /.*
script: unused
login: optional
secure: always
skip_files: app.yaml

GCloud Error: Not Found The requested URL was not found on this server

I followed this steps to deploy my angular 8 application in Google Cloud
https://medium.com/#karthiksagar/how-to-deploy-angular-8-app-on-google-cloud-platform-gcp-cdd79e5cc5cf
My app.yaml is as follows
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: sofbox-angular/index.html
upload: sofbox-angular/index.html
- url: /
static_dir: sofbox-angular
I have placed the app.yaml file inside dist/ directory as mentioned.
I am able to access the main url- http://www.myridemate.com/
but when clicked on blog the link is not accessible - http://www.myridemate.com/blog
It gives below error
Error: Not Found The requested URL /blog was not found on this server.
Tried adding extra handler for /blog in app.yaml and it didn't work.
This same code is working in my local and also in hostgator - https://www.myridemate.alexvijayraj.com/blog
Not sure what I am missing here. Is there some extra configuration required in app.yaml or anything in GCP?
Error Message in App Engine Logs:
{
"time": "2020-09-17T03:58:28.682252Z",
"severity": "WARNING",
"logMessage": "Static file referenced by handler not found: sofbox-angular/blog"
}
The answer in this thread worked for me. Angular 6 routes not found on Google App Engine
Remember to remove the two handlers that are already on the .yaml file (-url: ...)
handlers:
- url: /(.*\.(js|css|svg|png)(|\.map))$
static_files: dist/\1
upload: dist/(.*)(|\.map)
- url: /.*
static_files: dist/index.html
upload: dist/.*

What is the solution for the error when I deploy pubsub for PHP with App Engine?

I was working on google Pubsub with App Engine, to get notifications from google play about InApp subscriptions status.
When I deploy my app with the command "gcloud app deploy", error message comes:
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [/home/testaccount/php-docs-samples/pubsub/app/app.yaml]
Unable to assign value 'pubsub.js' to attribute 'url':
Value 'pubsub.js' for url does not match expression '^(?:(?!^)/.|..|((.).*(?!$).)$'
in "/home/testaccount/php-docs-samples/pubsub/app/app.yaml", line 6, column 8
My app.yaml file:
runtime: php55
api_version: 1
threadsafe: true
handlers:
- url: pubsub.js
static_files: pubsub.js
- url: /.*
script: index.php
env_variables:
GOOGLE_PROJECT_ID: "testproject"
I have followed the insturctions in the linl:
Writing and Responding to Pub/Sub Messages
I did not modify app.yaml file, I do not know what is going on? I tried to deploy "Hello, World!" for PHP on App Engine" exmaple and it worked.
Please help me to solve it.
url should start with a slash. Try:
- url: /pubsub.js
static_files: pubsub.js
After a week searching about why I get HTTP error 500 (Internal Server Error) when I browse https://testproject.uc.r.appspot.com/, I got the reason, it was from app.yaml file, all errors came from php version.
Old app.yaml:
runtime: php55
api_version: 1
threadsafe: true
handlers:
- url: /pubsub.js
static_files: pubsub.js
upload: pubsub.js
- url: /.*
script: index.php
env_variables:
GOOGLE_PROJECT_ID: "testproject"
New app.yaml:
runtime: php72
handlers:
- url: /pubsub.js
static_files: pubsub.js
upload: pubsub.js
- url: /.*
script: auto
env_variables:
GOOGLE_PROJECT_ID: "testproject"
Thank God.

Access static json file in google app engine 2.7 standard environment - IOError(2, 'No such file or directory')

We are trying to access .json file inside our python code in Google App Engine.
Here is our app.yaml
service: worker
instance_class: F2
runtime: python27
api_version: 1
threadsafe: true
automatic_scaling:
max_instances: 100
min_pending_latency: 200ms # default value
max_pending_latency: automatic
handlers:
- url: /stylesheets
static_dir: stylesheets
- url: /images
static_dir: images
- url: /javascripts
static_dir: javascripts
- url: /(.*\.(gif|png|jpg|json))$
static_files: static/\1
upload: static/.*\.(gif|png|jpg|json)$
application_readable: true
- url: /static
static_dir: static
application_readable: true
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /.*
script: worker.app
login: admin
libraries:
- name: webapp2
version: "2.5.2"
- name: jinja2
version: latest
We are using it in our application like this.
path = os.path.join(os.path.dirname(__file__)[0], '/static/google_web_app_script_credentials.json')
flow = InstalledAppFlow.from_client_secrets_file(path,self.GOOGLESHEETS_SCOPES )
But we are receiving the error.
IOError(2, 'No such file or directory')
We have tried various options of changing path including path = os.path.join(os.path.dirname(file)[0], '../static/google_web_app_script_credentials.json')
When we go to the GCP console -> Debug and review the current code we are able to see the .json file under static folder. This means that the file is there, we are not able to get the application to read it. This service is as "worker".
From your App Engine app, you don't have access to your static files. Move the file to another location within your project, and you will then be able to access it.
Even more importantly, you don't want to store credentials in your static folder! Anyone on the web will be able to access them via the URL!

How do i run FuelPHP on Google App Engine

Hi i have setup an app engine account. everything works ok with standard php. i have a local install of fuelphp, this works with no issues when running the development server of google app engine. however once i move it to the production application, i get an error stating the cache directory is unwritable of non existent. i read through some articles and it mentioned the application sandbox on GAE is not writable, so i went and manually change the configurations to point to an external path for the cache, the issues is this persist. i even tried to remove the usage of cache, ( false in config ) and hardcoded remove by commenting out. this just crashed everyting.
app.yaml
env_variables:
FUEL_ENV: 'production'
handlers:
url: /(.*.(htm$|html$|css$|js$))
static_files: public/\1
upload: public/(.*.(htm$|html$|css$|js$))
application_readable: true
url: /(.*.(ico$|jpg$|png$|gif$))
static_files: public/\1
upload: public/(.*.(ico$|jpg$|png$|gif$))
application_readable: true
url: /assets
static_dir: public/assets
url: /favicon.ico
static_files: public/favicon.ico
upload: public/favicon.ico
url: /.*
script: public/index.php
Log file patch: https://github.com/isatan/FuelPHP4Gae_patch
Deploy SQL instance, load database schema and setup your production config.php to connect to in via unix socket.

Resources