This is how graphql-js package detects promises:
function isPromise(value) {
return Boolean(value && typeof value.then === 'function');
}
value
is the returned value of your function. I'm using this code in my project and have no problem so far.