Making Datastore emulator work with local App Engine Development server

22 views
Skip to first unread message

Boris Brudnoy

unread,
Apr 15, 2025, 4:22:52 PMApr 15
to objectify-appengine
Hello all,

I'm stumped trying to migrate from Objectify 5 to 6. I followed the Datastore emulator setup instructions and introduced an ObjectifyService.init() call where my storage service is being initialized.

The backend for my app is starting up successfully, but upon the very first call to the Datastore, e.g.:

BaseMember entity = ofy().load()
.type(getEntityClass())
.filter("email", email.toString())
.first()
.now();

The call fails and throws the following into the logging console after some delay:

com.google.auth.oauth2.GoogleAuthException: com.google.api.client.http.HttpResponseException: 400 Bad Request
POST https://oauth2.googleapis.com/token
{
"error": "invalid_grant",
"error_description": "Bad Request"
}

I'm puzzled by the fact any authentication calls are happening at all, given that I seem to be configuring the Datastore libraries to talk to the local emulator. I have the following environment variables set:

DATASTORE_EMULATOR_HOST_PATH=http://localhost:8081/datastore
DATASTORE_DATASET=<my_project_id>
DATASTORE_EMULATOR_HOST=localhost:8081
DATASTORE_HOST=http://localhost:8081
DATASTORE_PROJECT_ID=
<my_project_id>
DATASTORE_USE_PROJECT_ID_AS_APP_ID=true

And yet I'm missing something. Does anyone have a clue what that might be?

Thanks,

Boris
Reply all
Reply to author
Forward
0 new messages