async using node.js HapiJS and couchbase sdk returning empty results


So I have the following code which is in a Hapi.JS handler, and is attempting to call couchbase sdk.

handler: async (request, h) => {
                var SpatialQuery = Couchbase.SpatialQuery;
                var sw = JSON.parse(request.payload.sw);
                var ne = JSON.parse(;
                var query = SpatialQuery.from('dev_spatialtest', 'spacetest').limit(100);
                return await myBucketQuery(query);

It calls this function

async function myBucketQuery(query){
    return bucket.query(query, async function(err, results){
                console.log("in results = " + JSON.stringify(results));
                return results;

the console.log in myBucketQuery returns the correct result, but does it after the hapi has already returned (or maybe not???) The result in postman comeback as

    "_events": {},
    "_eventsCount": 2

can anyone give me a clue what I am doing wrong here??


Hey @leerlemoniii,
Unfortunately the Node.js SDK does not support promises as you have used them. You will need to use a promisification library to translate your Promise-based code to callback-based for the Couchbase SDK. We are hoping to make this available soon though!
Cheers, Brett