Google App Engine not updating deployed files - google-app-engine

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

Related

Why does google app engine seem to use old code?

I've setup Google App Engine to run my AdonisJS API for my website. I update the code using the CLI for google cloud services ("gcloud app deploy"). I get a success message from the terminal, and I have checked both the cloud build and version number, and both are the most recent deployment. However, when I try to use my website, I get an error due to the API using old code and trying to access table columns from my database that no longer exist. I have downloaded the most recent cloud build file and checked the codebase within it and the updated code is there. I have also tried deploying multiple times, and it still is using the old code. Does anyone know why this is happening and/or how to fix this?
If you need more information, let me know. Thanks
ANSWER:
Fixed this a while ago, but wanted to update here just in case others ran into this. I discovered that when deploying to GAE through the command line, my build command wasn't running prior to the deploy since my script had an error, so it was uploading updated code, but not an updated build. So just make sure to run the build command prior to uploading to GAE and everything should work.
In console.cloud.google.com, go to your GAE project and check which version of your project is running I.e. which one is receiving traffic
Clear your cache.

Is there a URL for the latest version of a google cloud app engine deploy?

I've recently done a UI update for my website, the backend is all identical. I want to access the latest deploy (with the no-promote flag) from 'beta.my-website.com' but still access the 'normal' site from 'my-website.com'. Ideally this would dynamically serve the latest version, but if not could I set it statically to the URL with project ID? I have bought my domain from 123reg. Is there a way to direct to the latest version regardless of it's traffic serving status?
TL;DR Can you set up a 'beta' site at beta.mywebsite.com while still being able to access the live version on www.mywebsite.com on google cloud?
Any help would be greatly appreciated.
Thanks!
I don't think that can be done like that.
You could deploy to a different appengine project by putting a different project id and then have beta.mywebsite.com route to that project instead. The nice thing about this option is everything else would be isolated (i.e. no chance of your beta changes causing bad data in your production database, or tasks in your queues)
Another option would be to deploy to a different service within your project and use your dispatch.yaml to route beta.mywebsite.com to it https://cloud.google.com/appengine/docs/standard/python3/reference/dispatch-yaml
A third option would be to put beta as your version-id, and have your DNS redirect beta.mywebsite.com to beta-dot-your_project_id.appspot.com. However, when the user goes to beta.mywebsite.com they would ultimately see beta-dot-your_project_id.appspot.com in the URL bar. Also, when you're ready to go live, you would want to redeploy and promote that new version id and not promote the beta version-id.

Downloading App Engine source code

So it seems from a few SO questions I've seen that this is a problem among other users. Recently one of our head dev's left and I inherited a lot of his projects. One of which, is a website that what seems like lives on an app engine from google cloud platforms. From the App Engine documentation, to download source code you use the appcfg.py download_app command. Which I did, however the only results I get back from that call is:
Fetching file list...
Fetching files...
And then it just ends. No error message or any kind of message at all, and of course, it did not download the source code into the output dir I specified.
Scratching my head and looking at various SO posts, someone mentioned something about going into the google cloud vm directly and doing the same command, and to my surprise finding the same exact behavior that I did in my local terminal.
This made me realize it must be something else at play. I took a look at my versions tab in the App Engine dashboard on GCP. I see my instance running, it correctly says Serving and if I click the link it brings me to the website which loads fine. However, under Size it says 0 B which made me think perhaps this is why the download_app isn't downloading anything, because the version is 0 B?
What I'm trying to figure out is why it says 0 B for the version, when clearly the site runs fine and how I can get the source code for this. Here's a screenshot for reference
And screenshot of my terminal (local). Obviously I omitted the -A and -V flags, but they are correctly set and if I purposely make them incorrect I do indeed get an error message.
EDIT
Just so everyone is aware, I also made sure my user had the correct permissions. Owner, App Engine Owner... and some others. I don't think that's the problem.
When you deploy an App Engine Flexible application, the source code is uploaded to Cloud Storage on your project in a bucket named staging.<project-id>.appspot.com. You can navigate in this bucket and download the source code for a specific version as a .tar file.
Alternatively, you can find the exact Cloud Storage URL for your source code by going to Dev Console > Container Registry > Build History and select the build for your version. You'll find the link to your source code under Build Information.
One thing to note however is that the staging... bucket is created by default with a Lifecycle rule that deletes files older than 15 days automatically. You can delete this rule if you want so that all versions' source code is kept indefinitely.
In your case I believe that may not have helped since files may have been deleted already but it's worth knowing you can get the source code from there (source code isn't pushed to Source Repository by default, your developer had to configure it manually).
Posting this since none of the listed methods on the web didn't take me to the code (by June 2021)
Note: appcfg.py is deprecated by Google
You could try accessing your source code through;
Google Cloud Platform > Debugger > choosing the version of the
Application from combo at top.
This will list the files of that version on the left pane. There is no way to download code automatically but you can copy-paste the code.
Advice: Push your code to a Git repository to avoid this hassle next time.
Hope you will find this helpful.
In the developer console you can select the respective project and check:
on the Services page - which services, AKA modules - as they used to be (and still are) called in various places, you app has deployed
on the Versions page - which versions for each of the services are deployed
This information is what appcfg.py download_app expects. See also:
the various appcfg.py options using its --help flag
How do I download a specific service's source code off of AppEngine?
You can also access the deployed source code live (if everything else fails it could still be a last resort method to get the code, but tedious), see my answer to Google Cloud DataStore automatic indexing
Update:
I just now noticed in your screenshot that it's a flexible environment app. The appcfg.py docs are in the standard environment section, I suspect it's not applicable to the flexible environment, for which what's deployed is actually a docker image built during the deployment operation. From Deploying your application:
Deploy your app to App Engine using the gcloud app deploy
command. This command automatically builds a container image by using
the Container Builder service and then deploys that image to the
App Engine flexible environment. The container will include any local
modifications that you've made to the runtime image.
It might be possible to access the code on the actual GCE instance running the app, by connecting to the running instance and starting a shell in your app container, see Connecting to the instance

How to get BlogEngine.NET to run outside of a local environment?

I am trying to run BlogEngine.NET. It works fine locally in Visual Studio but whenever I publish it outside of my local computer none of the posts are showing up.
I think this is because none of the scripts or CSS are being loaded (the posts are done via AngularJS). I've made sure that the read and write permissions are allowed in IIS so I know that isn't the problem.
I believe that AngularJS isn't loading properly, as when I go to the admin panel the url returned with the 404 error is this:
8926/admin/%7B%7BSiteVars.RelativeWebRoot%7D%7Dadmin/#/dashboard
instead of:
8926/admin/#/dashboard
Even If I manually take out all of the %7B%7BSiteVars.RelativeWebRoot%7D%7Dadmin text, the posts still don't show up as they do locally which leads me to believe the posts are also tied to AngularJS as well.
Does anyone know how to fix this? This may not be a BlogEngine.NET problem as much as it is just a loading of Javascript and CSS problem inside of IIS
The documentation for my project is here.
BlogEngine.Net had moved to GitHub that is where the latest updates are at.
Best to go here:
https://github.com/rxtur/BlogEngine.NET
and try again with a fresh install.
I have a fresh install working with no issues here:
http://blogengine07.azurewebsites.net
Took a total of around 30 mins to it it 100% up and running, creating new web app service,database, change web.config, publish to Azure, and making some changes in settings.
What web host are you using to host your website?
You can also try Azure Web App Service for free here:
https://azure.microsoft.com/en-us/try/app-service/web/?language=cs
If you can get it to work there but not at your current web host then that points to a web server issue, since you are able to run it locally and on Azure.
Hope this helps.
Have a great Day!
Brian Keith Davis

How to set my default version in Google App Engine

I'm working on a google app engine app that, after a lot of progress, has multiple versions deployed. I'd really like to switch the default version, which is the very first version of the app, to something more recent, but there doesn't seem to be any way to actually do that.
This article https://gae-php-tips.appspot.com/2013/06/25/harnessing-the-power-of-versions-on-app-engine/ claims there is a "Make Default" button under the version tab, but shows an older version of the console.
In the new version of the development console, there is no such button. This seems like an extremely key feature, and I'm not sure why they've obfuscated it.
Can anyone point me in the right direction?? Thanks!
Currently you can use "Migrate traffic" feature to tell App Engine which version should receive 100% of all requests.
If, at some point, you may want to test a new version, you have an option of splitting all incoming requests between two or more versions of your app.

Resources