Skip to content

Getting PERMISSION_DENIED when running QuickstartSample class #813

@choudharysuchi

Description

@choudharysuchi

There is a requirement in my project to analyse videos based upon the text provided by the customer. Tried using Google Cloud Video Intelligence API. Referred code from "https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/video/cloud-client"

However, I am getting the below issue while executing the QuickstartSample.java from local by passing the video kept on my system.

Exception in thread "main" java.util.concurrent.ExecutionException: com.google.api.gax.grpc.ApiException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Google Cloud Video Intelligence API has not been used in project usable-auth-library before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/videointelligence.googleapis.com/overview?project=usable-auth-library then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:500)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:479)
at com.google.api.gax.grpc.OperationFuture.get(OperationFuture.java:113)
at com.video.main.QuickstartSample.main(QuickstartSample.java:59)
Caused by: com.google.api.gax.grpc.ApiException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Google Cloud Video Intelligence API has not been used in project usable-auth-library before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/videointelligence.googleapis.com/overview?project=usable-auth-library then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
at com.google.api.gax.grpc.ExceptionTransformingCallable$ExceptionTransformingFuture.onFailure(ExceptionTransformingCallable.java:108)
at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:53)
at com.google.common.util.concurrent.Futures$4.run(Futures.java:1123)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435)
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900)
at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811)
at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675)
at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:466)
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:442)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Google Cloud Video Intelligence API has not been used in project usable-auth-library before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/videointelligence.googleapis.com/overview?project=usable-auth-library then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
at io.grpc.Status.asRuntimeException(Status.java:543)
... 15 more

Following are the steps which i followed,

  1. Created a maven project with only QuickstartSample.java file. Able to do maven build with clean install args.
  2. Created account on Google Cloud Platform, created a project with name "VideoFilteration", saved the service account key locally with enabling it and configuring it in environment variables.
  3. Installed Cloud SDK followed by "gcloud init" and "gcloud auth application-default login".

To my surprise, I never created "usable-auth-library" project on google cloud account for which I am getting the said issue.

Please provide your valuable inputs, as I am stuck on this error.

Thanks in Advance.

Activity

lesv

lesv commented on Aug 17, 2017

@lesv
Contributor

The Video and DLP api's need GOOGLE_APPLICATION_CREDENTIALS set to a service account for that project.

choudharysuchi

choudharysuchi commented on Aug 18, 2017

@choudharysuchi
Author

Thanks for the reply.

However I have already configured this in environment variables as GOOGLE_APPLICATION_CREDENTIALS = absolute path of <VideoFilteration-6b6344b603b9.json>.

jabubake

jabubake commented on Sep 25, 2017

@jabubake
Contributor

It does seem like the environment variable GOOGLE_APPLICATION_CREDENTIALS is somehow not getting picked up. Can you try System.getenv("GOOGLE_APPLICATION_CREDENTIALS") within your code and confirm that it does correctly point to your credentials JSON ? Also can you provide information on your development environment ?

jabubake

jabubake commented on Jun 15, 2018

@jabubake
Contributor

Closing issue, please re-open if you are still running into issues.

jaindee

jaindee commented on Aug 2, 2018

@jaindee

Hi I am running into the same problem, however i am getting the correct path of the json file i provided.

ejgutierrezvega

ejgutierrezvega commented on Aug 3, 2018

@ejgutierrezvega

Hi, I'm following the quick start from Stackdriver and I'm getting the same issue.
https://opencensus.io/quickstart/java/metrics/#1

At the beginning I was having issues reading the system environments, but now I'm able to run the code input some samples and after some time I'm getting the following exception.

I created the system account with only the role of "Monitoring Metric Writer".

io.opencensus.exporter.stats.stackdriver.StackdriverExporterWorker export
WARNING: ApiException thrown when exporting TimeSeries.
com.google.api.gax.rpc.PermissionDeniedException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: The caller does not have permission
at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:55)
at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:95)
at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:61)
at com.google.common.util.concurrent.Futures$4.run(Futures.java:1123)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435)
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900)
at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811)
at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675)
at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:492)
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:467)
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:391)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:471)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:553)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:474)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:591)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

5 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lesv@ejgutierrezvega@jabubake@choudharysuchi@jaindee

        Issue actions

          Getting PERMISSION_DENIED when running QuickstartSample class · Issue #813 · GoogleCloudPlatform/java-docs-samples