Skip to content

Can't connect to local Datastore Emulator #1230

@sebelga

Description

@sebelga

Hi,
I just updated from 0.29 to 30.3 and I can't connect to the Datastore emulator locally.
This is the steps I do:

Launch datastore with:

gcloud beta emulators datastore start --project=my-project-id --data-dir /path/to/some/dir --host-port localhost:8380

It launches and tells me:

API endpoint: http://localhost:8380/datastore
...
Dev App Server is now running

Init gcloud-node with

var config = {
    projectId: 'my-project-id',
    // keyFilename: '/some/path/to/credential.key.json', (tried both with and without)
};

var gcloud = require('gcloud')(config);
var datastore = gcloud.datastore({
        apiEndpoint: "http://localhost:8380"
});

Create an Entity

var key = datastore.key('BlogPost');
datastore.save({
    key: key,
    data: {
        title: 'Hello world'
    }
}, function(err) {
    console.log(key.path);
});

I receive this in err:
"{"code":503,"metadata":{"_internal_repr":{}}}"

I then changed the apiEndPoint to "http://localhost:8380/datastore" (as indicated when launching the emulator) but then it blocks the request (does not come into the callback) and in the terminal it says:

E0414 09:11:46.140609000 4406423552 resolve_address_posix.c:126] getaddrinfo: nodename nor servname provided, or not know

As I said, I tried both with and withouth credentials without any difference.

Some help would be greatly appreciated! :)
Thanks a lot for this great library.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions