0

I'm having an issue running my node.js script on the google cloud app engine (flexible env). I ran the same code which works fine on my local machine, connecting to the same datastore with the same key. But it is not returning anything when it is run on the app engine.

    'use strict';

    const datastore = require('@google-cloud/datastore');
    const environment = process.env.NODE_ENV || 'development';

    var datastoreClient = datastore({ projectId: 'projectId', keyFilename: 'path/to/key.json' });

    var query = datastoreClient.createQuery('Countries').limit(1);
    datastoreClient.runQuery(query, function (err, country) {
      if (err) {
        console.log("Something went wrong");
      } else {
        console.log(JSON.stringify(country));
      }
      console.log("Completed");
    });

Nothing was printed out in the log on app engine. No even an error. On my local machine it prints out the data from the 'Countries' entity and 'Completed'.

Appreciate the advice. Thanks!

Nazar Ibrahim
  • 49
  • 1
  • 4
  • You might be hitting the issue described in this question: http://stackoverflow.com/questions/42036315/google-datastore-silently-failing-in-production-node-js – Ed Davisson Feb 06 '17 at 18:19
  • Thanks @EdDavisson. Seems to be a problem with the latest app engine images. I'll keep an eye on these threads then. Cheers! – Nazar Ibrahim Feb 07 '17 at 04:55

0 Answers0