cloud-firestore issue when running in DevAppServer GAE Standard Java 8
See original GitHub issueWhen using the latest Firestore library we are getting the following error (in devappserver, GAE Standard, Java 8):
Caused by: com.google.apphosting.api.ApiProxy$CallNotFoundException: Can't make API call urlfetch.Fetch in a thread that is neither the original request thread nor a thread created by ThreadManager at com.google.apphosting.api.ApiProxy$CallNotFoundException.foreignThread(ApiProxy.java:844) at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:116) at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:40) at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:543) at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:422) at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getResponseCode(URLFetchServiceStreamHandler.java:275) at com.google.api.client.http.javanet.NetHttpResponse.<init>(NetHttpResponse.java:37) at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:105) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:981) at com.google.auth.oauth2.UserCredentials.refreshAccessToken(UserCredentials.java:210) at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:160) at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:146) at io.grpc.auth.GoogleAuthLibraryCallCredentials$1.run(GoogleAuthLibraryCallCredentials.java:98)
The issue is triggered by a simple example:
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
Firestore firestore = FirestoreOptions.getDefaultInstance().toBuilder().build().getService();
// Firestore firestore = FirestoreClient.getFirestore();
DocumentReference doc = firestore.collection("cities").document("Mountain View");
try {
resp.getWriter().println("Count: " + doc.get().get().get("count"));
} catch (Exception e) {
throw new ServletException(e);
}
}
This one may be similar to the following two issues we fixed earlier: https://github.com/GoogleCloudPlatform/google-cloud-java/issues/2150 https://github.com/GoogleCloudPlatform/google-cloud-java/issues/2275 https://github.com/GoogleCloudPlatform/google-cloud-java/issues/2306 https://github.com/GoogleCloudPlatform/google-cloud-java/issues/2300
@neozwu is this the same issue?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
This issue occurs in latest versions of dev app server as well:
This was while trying to run a Firestore API call from the app.
Here’s my pom.xml: