Search code examples
google-app-enginegoogle-cloud-platform

Java 11 app running on Google Cloud App Engine fails with 401 error for registering debuggee


I deployed Java 11 app on Google Cloud App Engine, and app is running fine, I can see the home page in the browser, but when the app tries to call Microsoft Graph API (the HTTP call is executed by using Microsoft Graph SDK), I am getting runtime failure.

The failure relates to Google debugger, but I didn't even enable debugger. I found information that debugger is enabled by default when Google builds the container image. I have two options - either to figure out why I am getting 401 error for the debugger, and configure debugger properly, or disable debugger completely.

I tried to find information how to disable Google debugger for container image generation, but didn't find anything helpful. I also tried to find information how to configure debugger properly for app engine, and also was not able to find complete working instructions. Does someone know what I need to configure on App Engine to bypass this error:

    java.io.IOException: Server returned HTTP response code: 401 for URL: https://clouddebugger.googleapis.com/v2/controller/debuggees/register

at com.google.devtools.cdbg.debuglets.java.GcpHubClient.registerDebuggee

Solution

  • Assuming your Java app is in an App Engine Standard environment and using the bundled services, then you are still using appengine-web.xml file for app configuration. As stated in GAE standard Issuing HTTP(S) Request documentation:

    URL Fetch will handle all outbound requests and cause requests that you send to your VPC network or the client libraries to fail. If any of these scenarios apply to you, make sure that the url-stream-handler field in your configuration is not set to urlfetch.

    This scenario includes Google Cloud Debugger Client for Java hence the HTTP error. As a workaround, you can omit the following line in the appengine-web.xml file:

    <url-stream-handler>urlfetch</url-stream-handler>