Closed mcfarljw closed 6 years ago
@ofrobots what should we do here?
@mcfarljw Would you have some code that reproduces this scenario? Do you see the error when running locally on your machine, or when deployed on GCP, or elsewhere?
I can reproduce the issue with the following code:
global.Promise = require('bluebird');
global.Promise.config({
longStackTraces: true,
warnings: true
});
const Datastore = require('@google-cloud/datastore');
const datastore = new Datastore();
const kind = 'Task';
const name = 'simpletask1';
const taskKey = datastore.key([kind, name]);
const task = {
key: taskKey,
data: {
description: 'Buy milk'
}
};
datastore.save(task)
.then(() => {
console.log(`saved ${task.key.name}: ${task.data.description}`);
})
.catch(console.error);
This is a spurious warning from bluebird. The code is actually correct as is. Bluebird thinks this code is missing a return of a promise:
Changing this to the following gets rid of the spurious warning:
this.authClientPromise.then(callback.bind(null, null), callback);
This works as we are simply avoiding creating an extra promise for the call to .catch
(which is where bluebird is getting confused about us maybe returning a promise in the then
too).
I don't think this is a bug here (it is a bluebird issue IMO), but here's a work-around in case other people run into it: https://github.com/stephenplusplus/google-auto-auth/pull/29.
I've noticed this warning when using the google cloud datastore node library with bluebird as the promise library.