Google AppEngine only deploys first version - google-app-engine

I just changed my app.yaml to a new version number before deploying to AppEngine. Everything appeared to be working fine, but when I visit the website on appspot.com it still shows the old version, and https://appengine.google.com/ shows that version 1 is still the live version. What do I do to make it deploy my new version?

You need to set the default version in the application's Dashboard.
To see a non-default version the URL is http://<version>.latest.<appname>.appspot.com/.
Also, you can (and probably should) use text names for version labels instead of numbers.

Changing the version in your deployment descriptor (app.yaml) only uploads this new version, it does not set it as the default version. You set the default version in your Dashboard.

Go to your dashboard and make that particular version your default version. Feed the in this url to go to your dashboard: https://appengine.google.com/dashboard?&app_id=s~

Related

How to push the latest version of your web app using gcloud to make it live

I am currently working on a app that I am hosting on Google Cloud. I tried everything in the documentation but may have had the command 'default_expiration: "30d"' in the app.yaml file. I got rid of it but it won't let me push the latest version of my app to make it live. I tried everything I could think of such as 'gcloud app deploy --promote --stop-previous-version' but to no avail. How can I get the latest version of my code live using Google Cloud App Engine.
Cheers,
EDIT:
If I go to the latest version as 'www.version.app-name.appspot.com' it shows the latest version; however, in the App Engine Versions panel, it shows that version with 100% of traffic allocated to it even though when I go to 'www.app-name.appspot.com' it displays a very old version.
I tried deleting all the old versions on the App Engine Versions panel, including the version that is being displayed, and it still shows the old version when going to 'www.app-name.appspot.com' but going to the exact version number displays the correct version. The newest version shows 100% of traffic is being sent there.
Cheers,
It now magically works so I will post the steps I did. I managed to debug it and find out that the version with all the traffic according to the App Engine Version panel wasn't the version being displayed, so, I deleted all the old versions on the Version panel and then it still wasn't working. It was still the same error, that the newest version was not being displayed when visiting 'www.app-name.appspot.com' so I waited around half an hour and now it is displaying the correct version at the main address. See the question for more debugging information.
Cheers,

how do I delete multiple versions in an app on google cloud?

When I deploy a project I get this error
INVALID_ARGUMENT: Your app may not have more than 15 versions. Please delete one of the existing versions before trying to create a new version.
I also went to versions on google cloud and tried to delete it manually but it says you can not delete a version with traffic shares.
Please help, any advice are greatly appreciated
You'll need to keep one version (latest maybe?) and then migrate all traffic to it with the "Split Traffic" link here, away from all the other versions you want to delete.
Then you will be able to select and delete those versions since they no longer handle traffic.
Finally you deploy the new version (in fact you could do that as soon as you deleted enough versions to no longer see that error) and, if needed, migrate traffic to it.
Also see gcloud app deploy for options related to versioning and traffic migration right at deployment time which could help you prevent such situation in the future:
--promote
Promote the deployed version to receive all traffic.
True by default. To change the default behavior for your current
environment, run:
$ gcloud config set app/promote_by_default false
Overrides the default promote_by_default property value for this
command invocation. Use --no-promote to disable.
--stop-previous-version
Stop the previously running version when deploying a new version
that receives all traffic. Overrides the default
stop_previous_version property value for this command invocation.
Use --no-stop-previous-version to disable.
--version=VERSION, -v VERSION
The version of the app that will be created or replaced by this
deployment. If you do not specify a version, one will be generated for
you.

why google app engine doesn't delete my version?

I have a problem deleting app engine version.
In my Google app engine console, under the section "app engine"->"Version" I have different version of the same project. I delete one of these, i.e. test.myapp.appspot.com. and I can't see this version anymore in the list of the versions.
But if I try to make a call to an API of this version I have a response like this is still alive.
How can I completely delete this version? Like I never deploy it...
App Engine automatically redirects to the default version if the version you're navigating to isn't known (or has been deleted).
E.g.
If you're default version is:
https://1-0-0-dot-yourapp.appspot.com/
And you navigate to:
https://foo-dot-yourapp.appspot.com/
It'll automatically load the default version of the app (and not render a 500 error), despite the url showing https://foo-dot-yourapp.appspot.com/

google app engine: how to run different version

Suppose I uploaded another version (say, "version: 2" in file app.yaml ) of my Google App Engine application. Version 1 is still the default and version 2 is for testing. How do I run it then?
Once you upload a version on Appengine, you can switch between them easily.
Say that your app name is myapp, currently running version 1. You also have uploaded a version called 2-testing. Your default app (with version 1) can be reached by accessing myapp.appspot.com
If you wanted to access your versions explicitly, you joust need to access <version_name>-dot-myapp.appspot.com. Following the example it would be:
1-dot-myapp.appspot.com or 2-testing-dot-myapp.appspot.com
The -dot- is equivalent to <version>.<appname> but allows you to correctly serve a secure application with SSL
You can mark any version you want as default (serving myapp.appspot.com) using the admin console
edit: this is the official documentation page talking about domains and subdomains in Appengine
Under versions in your admin console you can find the live uri of a version, if you select the version.
And you can use traffic splitting, where you can use your own client ip or a cookie to test a version.
Docs: https://developers.google.com/appengine/docs/adminconsole/trafficsplitting

Google App Engine not updating deployed files

I'm getting some strange issues with google app engine serving old versions of files. I have included some logging in one of my servlets and deployed to google app engine several times over the last 24 hours. However, instead of seeing the logging i added, I'm seeing logs from a previous version of the file every time the servlet runs.
I've tried changing versions and redeploying but this doesnt seem to fix the problem.
I'm using Eclipse Juno with the app engine plugin if that makes a difference.
Any ideas what I can try or what I might be doing wrong?
I had a similar problem recently, and that I fixed by logging into appengine.google.com>MyAppIdentifier>(Main)>Versions and selecting the current version as the default.
This should not only serve your latest version, but also use the latest version for log viewing and other administrative tasks.
In the logs, make sure that you're checking the correct version:
Otherwise redeploy to a brand new version and check that version explicitly directly from the version url that can be found under the Versions section.
Make sure that before redeploying your APP after making changes you Remove Launch and Remove All Terminated launches by pressing the double cross buttons next to the "clear console" buttons on the console window in Eclipse...I hope this solve your problem.
December 2020 Answer
Not sure if this is an account or billing specific setting, but I found that App Engine started not updating to my latest app deploy once I reached 50 Versions in my App Engine list.
After deleting a bunch of old versions (taking down to 30) on next deploy it picked up my latest changes immediately.
It could be due to caching issue. Try reloading the website by adding a query parameter . Eg <website-url>?q=1 and see if changes are reflected
Open the url -> latest-version-number-dot-website-url . Latest version number can be obtained by clicking on version menu item on the side bar as seen below
If you have app.yaml file in your source code. Try removing headers related to caching and deploy and check to confirm its a caching issue. Caching headers could be of below form
Cache-Control: public, max-age=604800, immutable
Also make sure your project compiles correctly and doesn't contain any errors. I had this problem basically because I was deploying old compiled code, while it gave me an error "you have errors in your project, are you sure you want to deploy?"
I tried all the suggestions on SO, but ultimately, I found the best fix.
Because I transferred domain names and web hosting, I neglected to change my Domain's Resource Records. After making sure my code worked properly with the application (appname.appspot.com), I created a Custom Domain found in Console menu > App Engine > Settings > Custom domains
After you add the custom domain, make sure you change your Domain setting's CNAME www alias to the prescribed value (for me it was ghs.googlehosted.com).
Since changing that CNAME value, all of my subsequent deploys updated immediately. Hope this works for you and all others. Happy coding!
The gcloud (at list in python) has problem with line 'skip_files' in app.yaml,
So you can try the old method of deploying app with app engine,
use appcfg.py instead of gcloud.
see how in https://cloud.google.com/appengine/docs/standard/python/tools/uploadinganapp

Resources