Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

App Engine running old code after new deployments

I am trying to debug an API that I have running on a GCP App Engine. Originally, the error I was trying to fix was an issue with an import statement on line 7 of one of my JS files. 

I have deployed new code that should either fix the issue entirely, or push the import statement to a different line. 

However, when I run " gcloud app logs tail -s default" and call my API, I get logs saying that the error is still occurring on line 7.  I know that this is not true, because it is still an import error, but line 7 is now a blank line. 

I tried deleting all of the old versions of the service in the Cloud Console, but I am still experiencing this problem. How can I fix this?

Solved Solved
0 2 605
1 ACCEPTED SOLUTION

Try this

1. Deploy your changes as a different version i.e. specify a version number 

gcloud app deploy --version=<version_number>

2. Invoke your app's url for this new version and confirm everything works

https://VERSION-dot-SERVICE-dot-PROJECT_ID.REGION_ID.r.appspot.com

3. If everything works, you can migrate traffic to this new version and then delete the old version.

For an overview of versions and services for an app, see Google documentation

    ......NoCommandLine ......
https://nocommandline.com
        Analytics & GUI for 
App Engine & Datastore Emulator

View solution in original post

2 REPLIES 2

Try this

1. Deploy your changes as a different version i.e. specify a version number 

gcloud app deploy --version=<version_number>

2. Invoke your app's url for this new version and confirm everything works

https://VERSION-dot-SERVICE-dot-PROJECT_ID.REGION_ID.r.appspot.com

3. If everything works, you can migrate traffic to this new version and then delete the old version.

For an overview of versions and services for an app, see Google documentation

    ......NoCommandLine ......
https://nocommandline.com
        Analytics & GUI for 
App Engine & Datastore Emulator

Hi @ajaybhatta49,

In addition to the suggestions of @NoCommandLine, also note that the tail function from the command gcloud app logs tail -s default  can show more than one recorded logs. The oldest of which is the one that’s displayed at the top. 

For instance, let’s assume the following events happened sequentially:

  1. You deployed an app
  2. An error was encountered during deployment
  3. You resolved the issue locally (like making some code changes)
  4. You redeployed the updated code

After running the logs tail command, the displayed error that was logged during the first attempt will still be printed out by the logs tail command.

For further reference, you can also check this reminder pointed out by @Zach W from this Stack Overflow question in relation to an instance when Google App Engine seems to run an old code. In some cases, the updated code may have been uploaded, but not the updated build perhaps due to some issues in the build command that prevented the code from being built.

I hope my additional feedback above is helpful as well.