Unable to detect text in a base64 image uri in google cloud vision

I want to get extract the text from an image(I am using Google cloud vision API for that). The image is in the form of base64.
My Code so far:

const client = new vision.ImageAnnotatorClient({
  keyFilename: "./MyProjectCredentials.json",

const request = {
    "requests": [
        "features": [
            "type": "DOCUMENT_TEXT_DETECTION",
       "image": { 
             "content": "/9j/.../Z"

const getText = async () => {
    const [result] = await client.documentTextDetection(request);
    const fullTextAnnotation = result.fullTextAnnotation;

This is the error I am getting:
Error Message(It says Image not present)

Thanks in advance.

Is "content": "/9j/.../Z" the exact code, or just an approximation of what you have?

@eric-bounce “content” is the base64 encoded image.

Right, I was just confirming that "/9j/.../Z" was an approximation of what you had in your codebase, seeing as the error says image not present.

So what do you suggest to solve this problem

Haha I’ll try again, perhaps I’m being unclear.

I’m asking if "/9j/.../Z" is the EXACT code you have in your codebase. Your error says “Image not present”, so I’m curious if there’s a problem with the value you are passing into the "content" key. Perhaps if you pasted your code into a codepen it might be easier to look into.