google-cloud-node: Error with Datastore Emulator

After following the instructions in the gcloud documentation, I still can’t get the local Datastore emulator working. I’ve set up a REST API to store data in my Datastore when I receive specific requests. These requests correctly result in storing the data in my Datastore when the application is deployed to Google Cloud, but when I try to perform the same requests locally, I receive the following error:

{ [Error: Bad Request] code: 400, metadata: Metadata { _internal_repr: {} } }

The command line running the gcd.sh script is displaying the following when I send the request, but shows no errors:

May 19, 2016 9:33:39 AM io.gapi.emulators.grpc.GrpcServer$3 operationComplete
INFO: Adding handler(s) to newly registered Channel.
May 19, 2016 9:33:39 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
May 19, 2016 9:33:40 AM io.gapi.emulators.grpc.GrpcServer$3 operationComplete
INFO: Adding handler(s) to newly registered Channel.
May 19, 2016 9:33:40 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.

Does anyone have any idea what might be going on?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 31 (14 by maintainers)

Most upvoted comments

I just realized that I was importing my projectId as follows:

var dataset = gcloud.datastore({
    projectId: process.env.GCLOUD_PROJECT
});

But hadn’t used the command line to specify the value of GLOUD_PROJECT. It’s working now that I’ve done that.

Thanks for being so quick to respond.