I’m by no means an expert here, but try these changes:
exports.getValue = function (options) {
becomes
exports.getValue = async function (options) {
and
resizeImage();
becomes
await resizeImage();
If that doesn’t work, I’m sure somebody with more node.js experience will easily solve this. Your function is just not waiting for the process to complete before returning.