Search code examples
javagoogle-cloud-platformgoogle-apigoogle-cloud-dataflowgoogle-api-java-client

Google cloud dataflow restapi always returns 403-SERVICE_DISABLED


I have this dependency

<dependency>
    <groupId>com.google.apis</groupId>
    <artifactId>google-api-services-dataflow</artifactId>
    <version>v1b3-rev20221025-2.0.0</version>
</dependency>

Here i am building the dataflow:

private fun dataflow(): Dataflow = Dataflow.Builder(
    "My credentials",
    ...,
    ...
).build()

When i try to invoke some of the dataflow methods it always returns 403-SERVICE_DISABLED although i have pipelines with jobs in my project.

EX:

dataflow().projects().jobs().list("myProjectId").execute()

I tried changing the dependency version, calling different methods but the result is the same. I have dependencies for other resources and they works fine.


Solution

  • I found the solution. The problem was that the service account which i provide as ServiceAccountCredential was in another project where this API was not enabled. So the API have to be enabled in the project where service account is located and in the project, where my resources are located.