Evaluation failed: a when sending media

I am trying to build a whatsapp bot using electron and whatsapp-web.js. The bot works fine with sending normal messsages like text, but when I try to pass an image it throws this error:

Server stdout: Error: Evaluation failed: a
    at ExecutionContext._ExecutionContext_evaluate (D:ProjectsWebProjectsWhatsapp Sendernode_modulespuppeteer-corelibcjspuppeteercommonExecutionContext.js:229:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (D:ProjectsWebProjectsWhatsapp Sendernode_modulespuppeteer-corelibcjspuppeteercommonExecutionContext.js:107:16)
    at async Client.sendMessage (D:ProjectsWebProjectsWhatsapp Sendernode_moduleswhatsapp-web.jssrcClient.js:938:28)
    at async D:ProjectsWebProjectsWhatsapp Senderserverscript.js:167:17

my code:

var media = MessageMedia.fromFilePath(image_path);
console.log(media);
await client.sendMessage(groups[0]._serialized, media, {
    caption: message,
});

I debugged my code and there was nothing. the way I send images is by letting the user select an image and convert it to base64 in the html. when he clicks send, the base64 is re-converted back into an image in a local path like project/data/image.jpg and then that path is used in the MessageMedia.fromFilePath method. I ensured the image is saved and the path is correct. also the groups[0] returns the first common group between this number and the authenticated number and it works just fine. can someone help me?

EDIT:

I found that this way didn’t pass the data parameter in the MessageMedia object, so I tried to create it manually like new MessageMedia('image/png', image //base64, fileName) and now it shows this error

Server stdout: Error: Evaluation failed: DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
    at window.WWebJS.mediaInfoToFile (pptr://__puppeteer_evaluation_script__:520:35)
    at window.WWebJS.processMediaData (pptr://__puppeteer_evaluation_script__:317:36)
    at window.WWebJS.sendMessage (pptr://__puppeteer_evaluation_script__:19:39)
    at pptr://__puppeteer_evaluation_script__:10:45
    at ExecutionContext._ExecutionContext_evaluate (D:ProjectsWebProjectsWhatsapp Sendernode_modulespuppeteer-corelibcjspuppeteercommonExecutionContext.js:229:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (D:ProjectsWebProjectsWhatsapp Sendernode_modulespuppeteer-corelibcjspuppeteercommonExecutionContext.js:107:16)
    at async Client.sendMessage (D:ProjectsWebProjectsWhatsapp Sendernode_moduleswhatsapp-web.jssrcClient.js:938:28)
    at async D:ProjectsWebProjectsWhatsapp Senderserverscript.js:167:17