Wait for the Google Vision OCR promise in node.js/express and return it
Clash Royale CLAN TAG #URR8PPP Wait for the Google Vision OCR promise in node.js/express and return it I am having problems to return a promise from the Google Vision OCR. Here is the sample code from Google: const vision = require('@google-cloud/vision'); // Creates a client const client = new vision.ImageAnnotatorClient(); /** * TODO(developer): Uncomment the following line before running the sample. */ // const fileName = 'Local image file, e.g. /path/to/image.png'; // Performs text detection on the local file client .textDetection(fileName) .then(results => { const detections = results[0].fullTextAnnotation.text; console.log('Text:'); console.log(detections); }) .catch(err => { console.error('ERROR:', err); }); This will output the full text to the console. If I put the above code into a function and return the variable detections I get only undef...