google-cloud-java: DEADLINE_EXCEEDED when using Cloud Pub/Sub library from Compute Engine
When using the Cloud Pub/Sub library in a Java application that has been deployed in a Google Compute Engine instance, a DEADLINE_EXCEEDED exception occurs. The application resides in a Docker container within a Container Engine-managed Compute Engine instance. The Pub/Sub topic and the Compute Engine instance are in the same project.
The Compute Engine service account has project editor permissions.
No problems with the old google-api-services-pubsub library.
The code to create the instance looks like this:
InputStream credentialsStream = IOUtils.toInputStream(SERVICE_ACCOUNT_JSON, StandardCharsets.UTF_8);
Credentials credentials = ServiceAccountCredentials.fromStream(credentialsStream);
PubSubOptions options = PubSubOptions.newBuilder().setCredentials(credentials).build();
PubSub pubsub = options.getService();
Then doing something like this (or alternatively, create a topic):
for (Subscription subscription : pubsub.listSubscriptions().getValues()) {
...
}
results in the following:
com.google.cloud.pubsub.PubSubException: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED
Versions:
google-cloud-pubsub - v0.6.0
google-auth-library-oauth2-http - v0.6.0
google-auth-library-credentials - v0.6.0
google-* - v1.22.0
I also found this issue at Stackoverflow
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 36 (12 by maintainers)
Commits related to this issue
- deps: update dependency com.google.cloud:google-cloud-bigquery to v2.14.1 (#1430) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the foll... — committed to googleapis/google-cloud-java by renovate-bot 2 years ago
- chore(main): release 2.3.3 (#1437) :robot: I have created a release *beep* *boop* --- ## [2.3.3](https://github.com/googleapis/java-bigquerydatatransfer/compare/v2.3.2...v2.3.3) (2022-08-09) ### ... — committed to googleapis/google-cloud-java by release-please[bot] 2 years ago
I am having this problem when running locally in my project. I’m using
google-cloud version 0.8.0
. I’ve tried the previous suggestions and nothing solved my problem. I’m still getting this exception:java.util.concurrent.ExecutionException: com.google.cloud.pubsub.PubSubException: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED
.Does anyone have any similar problem?
+1. Same happening to me. Only fixed when I force netty-all version like recommended above.