I am currently working on an application in Next.js where I need to encode my image to base64. Initially, I used btao and it worked well until I tried deploying to Vercel, which resulted in an error stating that btao was undefined. After researching a solution, I found that using
Buffer.from(
icon,
"binary"
).toString("base64")
should resolve the issue. However, upon redeploying to Vercel, I encountered the following error:
Unhandled error during request: TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received null
Is there anyone else who has faced this problem?