Unable to connect to emulator running on docker compose with client 7.5.1 #1119
Labels
api: datastore
Issues related to the googleapis/nodejs-datastore API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
I have development environments and CI to run Datastore emulator and an application that connect to it on Docker Compose.
Those connections are resolved by the service name on the overlay network within it, such as
datastore:8081
.Since client version 7.5.1, these cannot connect to the emulator.
This was triggered by this PR: #1101
When the
baseUrl_
does not include a part that means the local network,grpc.credentials.createInsecure
is no longer used.This change is for a custom endpoint, and the endpoint is given by the
DATASTORE_EMULATOR_HOST
environment variable.As a result, authentication is not skipped when the emulator host is something like
datastore:8081
.To support custom endpoints requiring authentication, how about using a another environment variable instead of reusing the existing one? (like
DATASTORE_CUSTOM_HOST
) I think users who set theDATASTORE_EMULATOR_HOST
are expecting development use and not expecting authentication to be required.Workaround
Setting
network_mode: "host"
and expose the emulator port for joining the host network, we can includelocalhost
in endpoint url. However, this occupies a port on the host and may need to be adjusted.Environment details
@google-cloud/datastore
version: 7.5.1Steps to reproduce
This is the reproduction code using two different client versions, including docker-compose.yaml:
https://gist.github.com/pokutuna/314248d183f6fbfe60154f63751d3655
The text was updated successfully, but these errors were encountered: