Eduardo Nicolalde
Eduardo Nicolalde

Reputation: 77

java.io.IOException: Error getting access token for service account: connect timed out, iss: <>@<>.iam.gserviceaccount.com

i get this error after i change from local to docker-compose environmente, I deploy my containers with the same localtime and zone as my host using volumes:

volumes:
  - "/etc/timezone:/etc/timezone:ro"
  - "/etc/localtime:/etc/localtime:ro"

I verify it is ok and don't know why there is a connection time out error. what can be the error ? because it works fine when i run it on intellij and then it crashes in docker-compose deployment.

This is where i get the error:

this.credentials =
                GoogleCredentials
                    .fromStream(is)
                    .createScoped(Collections.singletonList("https://www.googleapis.com/auth/rcsbusinessmessaging"));
            this.credentials.refreshIfExpired();

Seems like a network issue but my firewall is down and i dont really know if it is allowing traffic from my container to the google's tokens endpoint. Variables "is" is an InputStream with my google credentials

Also I have a connection to pubsub as well

GoogleCredentials credentials =
                GoogleCredentials.fromStream(is2)
                    .createScoped(
                        Collections.singletonList("https://www.googleapis.com/auth/pubsub"));
            credentials.refreshIfExpired();

Where "is2" is another inputstream with my service account key.

Upvotes: 0

Views: 2911

Answers (1)

Eduardo Nicolalde
Eduardo Nicolalde

Reputation: 77

It was a network issue solved it in the yml file: network_mode: "bridge" or network_mode: "host"

Upvotes: 0

Related Questions