question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google PubSub Subscriber does not fail on Unauthenticated exception

See original GitHub issue

Thanks for stopping by to let us know something could be better!

Please include as much information as possible:

Environment details

  • OS: Mac and Ubuntu-Linux
  • Java version: 8
  • google-cloud-java version(s): 1.40.0

Steps to reproduce

  1. Run com.google.cloud.pubsub.v1.Subscriber as usual using FixedCredentialsProvider
  2. Delete the credential
  3. I am expecting it to fail, but it does not seems to fail, just printing lots of error messages, is this by design?

Stacktrace

io.grpc.StatusRuntimeException: UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
	at io.grpc.Status.asRuntimeException(Status.java:526)
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:420)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:684)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:403)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:459)
	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:546)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:467)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:584)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Code snippet

I am running in Scala, but I doubt it matters

      val subscriber = Subscriber
        .newBuilder(subscriptionName, messageReceiver)
        .setCredentialsProvider(credentialsProvider)
        .setFlowControlSettings(flowControl)
        .build()

      val done = subscriber.startAsync()
      done.awaitTerminated()

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kolea2commented, Dec 26, 2018

Hi @qingwei91, I tried reproducing this and was able to get this to enter the failed state. I created a subscriber with valid credentials, saw no errors. I then deleted the credentials, reran, and saw the same error you did and it entering the failed state. To highlight, here’s a piece of my listener code (in Java):

subscriber.addListener(new Subscriber.Listener() {
        @Override
        public void failed(ApiService.State from, Throwable failure) {
             System.out.println("Failed");
        }
        ...

My error message is the same as what you posted above, and I can see “Failed” being printed to the console. Any other information or steps I could be missing to help debug this?

0reactions
qingwei91commented, Dec 26, 2018

@kolea2 I’ll upgrade and try again, I’ll close this issue for now

Thanks for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Codes | Cloud Pub/Sub Documentation
Error HTTP Code Description UNAUTHENTICATED 401 The client is not authenticated properly. UNAVAILABLE 503 The service was unable to process a request.
Read more >
Problem with authentication to pubsub with subscriber (Java ...
Hi,. I fear that I have come across a bug. Since last week subscriptions don't work with the Java client. I didn't change...
Read more >
Google Pub/Sub API gets OAUTH2 authentication failure ...
Caused by: com.google.api.gax.rpc.UnauthenticatedException: io.grpc.StatusRuntimeException: UNAUTHENTICATED: Request had invalid authentication ...
Read more >
PublishGCPubSubLite processor in Apache NiFi is no...
google.api.gax.rpc.UnauthenticatedException: io.grpc.StatusRuntimeException: UNAUTHENTICATED: Request had invalid authentication credentials.
Read more >
Amazon Simple Notification Service (SNS) FAQs
Amazon SNS follows the “publish-subscribe” (pub-sub) messaging paradigm, ... logs for unauthenticated ConfirmSubscription and Unsubscribe calls are not ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found