google-cloud-platformgoogle-app-enginektor

Unable to deploy Google App Engine with Java 11 Runtime


I was using Java 8 runtime on my Ktor project until now and the project was getting deployed without issues but now as I migrate to Java 11 runtime, I am having issues.

I was using appengine-web.xml and web.xml to specify the description but since I am migrating I've created a app.yaml file that looks like this :

app.yaml ->
runtime: java11
entrypoint: 'ProjectName-1.0-SNAPSHOT.jar'
instance_class: F1
automatic_scaling:
  max_pending_latency: 500ms
  min_idle_instances: 1
  max_idle_instances: 1
  max_concurrent_requests: 80
  min_instances: 1
  max_instances: 1
  target_cpu_utilization: 0.95
  target_throughput_utilization: 0.95

I've updated the JAVA_HOME variable to point to the Java 11 installation directory. I 've updated my build.gradle (groovy) to include the following :

build.gradle ->
sourceCompatibility = 11    
targetCompatibility = 11 

Here is the error log on google cloud console after running the "gcloud app deploy" command:

Starting Step #2 - "build"
Step #2 - "build": Already have image (with digest): asia.gcr.io/gae-runtimes/buildpacks/google-gae-18/java/builder:java_20231016_RC00
Step #2 - "build": ===> ANALYZING
Step #2 - "build": ERROR: failed to initialize analyzer: getting previous image: getting config file for image "asia.gcr.io/projectName/app-engine-tmp/app/default/ttl-18h:latest": GET https://storage.googleapis.com/asia.artifacts.prjectname.appspot.com/containers/images/sha256:{theHashCodeHere}?access_token=REDACTED: unexpected status code 404 Not Found: <?xml version='1.0' encoding='UTF-8'?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Details>No such object: asia.artifacts.projectname.appspot.com/containers/images/sha256:{theHashCodeHere}</Details></Error>
Finished Step #2 - "build"
ERROR
ERROR: build step 2 "asia.gcr.io/gae-runtimes/buildpacks/google-gae-18/java/builder:java_20231016_RC00" failed: step exited with non-zero status: 1

Solution

  • This behavior may be encountered due to transient issues within App Engine’s infrastructure causing a race condition within the deployment process, attempting to get an image that may not be present yet within the GCS bucket in which these images are stored by default.

    Another possibility could be that part of the image, or perhaps the bucket in which these images are stored may have been deleted.

    I believe that this issue may be caused by a transient issue within GAE’s architecture.

    The possible solutions might be:

    1. Retry this operation after a few hours which may result in successful deployment.

    2. Using the gcloud app deploy command with the --no-cache flag helps solve the issue at once. This is because the --no-cache flag allows the build step within the deployment process to not use cached images, and might resolve the conflict occurring within the build operation for the affected App Engine instance.