API Not working suddenly

Hi all!

I have used the free api and enjoyed it simply. This code worked perfectly BUT all of the sudden this code no longer works…

ocrSpaceApi.parseImageFromLocalFile(imageFilePath, options)
console.log("!")
.then(function (parsedResult) {
console.log(parsedResult)
var parsedText = parsedResult.parsedText;
console.log(‘parsedText: \n’, parsedText);
// Add support in regex for all Operating Systems Windows would be \r\n, but Linux just uses \n and Apple uses \r.
var formattedTextArray = parsedText.replace(/\d.\s+|[a-z])\s+|•\s+|[A-Z].\s+|[IVX]+.\s+/g, “\n”).split("\n");
// var results = [parsedResult.parsedText.replace(/\d.\s+|[a-z])\s+|•\s+|[A-Z].\s+|[IVX]+.\s+/g, “”).split(’.’).join("").split("\n")];
// console.log(results)
res.send({ results: formattedTextArray })
console.log(‘ocrParsedResult: \n’, parsedResult.ocrParsedResult);
}).catch(function (err) {
console.log(‘ERROR:’, err);
});

Now I am getting TypeError: Cannot read property ‘then’

of undefined.

I cannot get past the callback. Any ideas please?

Thank you!

Does the OCR API call itself work ok?

Yes indeed it does. So I guess it seems it is not an API issue itself. Rather, the wrapper.