Reputation: 760
I am trying to call Google datastore inside dataflow job I am getting null instance
datastore = DatastoreOptions.getDefaultInstance().getService();
Upvotes: 0
Views: 240
Reputation: 760
Try putting this code in the main function not inside dataflow Pipline.
Upvotes: 1
Reputation: 306
This could probably be a credential issue. Could you try this,
Credentials credentials = context.getPipelineOptions().as(GcpOptions.class).getGcpCredential();
Datastore datastore = DatastoreOptions.newBuilder().setCredentials(credentials).build().getService();
Upvotes: 1