How to resolve the error 'not defined' in node js

i wrote a script which throws error as 'rows is not defined' but it seems to be correct :

function myFunction(resourceIdentifiers,callback) {

    dbconnection.execute( function(err,response) {

        response.query('call SP_ExposePricingDetailforUI(' + resourceIdentifiers + ')',
            function (err, rows, fields) {
                callback(err, { rows: rows, fields: fields});
            }
        );
    } );

    return rows;
}

module.exports.myFunction = myFunction;

After I formatted your code to make it readable, I see that the line return rows exists outside your callback function, where rows is not in scope. You need to define rows directly within myFunction and then assign to it from within your sproc callback function.