Google flexible app engine spring boot project running on local with datastore is giving the com.google.cloud.datastore.DatastoreException
Unauthenticated
exception while saving entity.
{
"timestamp": 1512077140003,
"status": 500,
"error": "Internal Server Error",
"exception": "com.google.cloud.datastore.DatastoreException",
"message": "Unauthenticated.",
"path": "/users"
}
The error description here says the request header does not have valid authentication header, But where to place the auth header does not mentioned.
anybody faced same kind of situation?
Canonical Error Code:
UNAUTHENTICATED
Description: The
com.google.cloud.datastore.DatastoreException
simply indicates that the request did not have valid authentication credentials.Recommended Action: Do not retry without fixing the problem. In this case, you need to check the login credentials again.
More read can be found on this page https://cloud.google.com/datastore/docs/concepts/errors#error_codes
Solution:
Simply you have to run
gcloud beta auth application-default login
. But I spent a half of a day until found it there. I thought it should be enough togcloud init
. As an alternative, you can use google authentication via Google OAuth2 but that is the hard way.