> On 27 Sep 2019, at 00:25, 'Jose Antonio Soni Solchaga' via Google App Engine
> <[email protected]> wrote:
>
> Hello Alessandro,
>
> The error message you are experiencing is because of wrong authentication.
>
> Here you can see a Stack Overflow question where this was answered.
Agreed, but a little debugging shows that Google Client Library is trying to
connect to the actual cloud endpoint of the project: supplying the credentials
through `gcloud auth application-default login` or `gcloud iam service-accounts
keys create` results in the test code connecting to the production datastore…
According to
https://cloud.google.com/docs/authentication/production#finding_credentials_automatically,
if no credentials are provided the hosting environment should automatically
provide connection hints for the local resources: I’d expect Java 8 Local
Development Server to automatically connect Google Client Library to the local
Datastore Emulator, replicating the application behaviour when deployed in
cloud, but that’s apparently not the case.
I’m currently working around the issue by testing locally using both the Local
Development Server and the standalone Datastore Emulator as:
gcloud beta emulators datastore start \
—project=project-id \
--host-port=localhost:8081 \
--data-dir=target/war
DATASTORE_EMULATOR_HOST=localhost:8081 java_dev_appserver.sh \
--port=8080 \
target/war
However, the process is quite cumbersome and difficult to automate: what I’m
looking for is a way to automatically connect Google Client Library to the
Datastore Emulator managed by the Java 8 Local Development Server when
launching the app with something like
https://github.com/GoogleCloudPlatform/app-maven-plugin, e.g. `mvn
appengine:run`.
-----------------------------------------------------------------------------------------------------------------------------------------
alessandro bollini ph.d. - tech lead - linkedin.com/in/alessandrobollini
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/5335AD5B-8B52-47DB-A228-33B899B7137E%40metreeca.com.