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!