I am trying to set up a serverless function on vercel, which uses Google Vision OCR to annotate the images. I am able to successfully do it locally but having a hard time figuring out how to add the GOOGLE_APPLICATION_CREDENTIALS
on Vision OCR. I have stored the full service-key.json file in an environment called GOOGLE_APPLICATION_CREDENTIALS
but that did not do anything.
Here is a brief overview of the code:
import vision from '@google-cloud/vision';
const vision = vision.ImageAnnotatorClient();
const analyze = async (req, res) => {
const [result] = await client.textDetection(req.body.image);
res.send(result)
}
I have tried using google-auth-library
and printing out an auth token so that I could call the Google REST API but that did not work either