I tried to connect datastore using service account, I have given role as owner. Once service account is created, in the Managed keys option, added key and generate token as JSON, finally exported as env in intellji. I am getting below exception
Here are some suggestions on how to troubleshoot further:
Verify API Activation:
Account Access: Ensure you’re logged in to the Google Cloud Console with an account that has view and manage permissions for the project.
Double-check Project: Verify the Datastore API status is Enabled under the correct Google Cloud project: Verify Datastore API status
Propagation Delay: API activation can take a few minutes to propagate. Wait for 5-10 minutes and retry connection.
Service Account Configuration:
Valid JSON Key: Ensure the service account’s JSON key file is valid, accessible, and not expired or revoked. Do not share the JSON key file publicly and handle it securely.
Full Path in Env Variable: Set GOOGLE_APPLICATION_CREDENTIALS to the full file path of the JSON key, not just the directory.
Role: Make sure the service account has the “Datastore Owner” role or other suitable permissions for Datastore access.
Code Reference: Check your code properly references the service account credentials when connecting.
Network Issues:
Connectivity: Confirm your network connectivity. Can you access other Google Cloud services?
Corporate Network: If on a corporate network, check for egress controls or proxy settings that might block Google Cloud APIs.
Different Network: Try accessing the Datastore API from another network environment to rule out local network issues. If testing from home, ensure your personal firewall or antivirus isn’t blocking the connection.
Project ID: Verify you’re using the correct project ID in your connection configuration.