running into an error while uploading an image to storage

when users sign in with another platform, i get their profile picture as base64, and upload it to supabase storage with this code:
  const { data, error } = await supabase.storage
    .from("studentvue-profile-pictures")
    .upload(`${userId}.png`, base64.parse(userInfoResp.StudentInfo.Photo), {
      contentType: "image/png",
      upsert: true,
    });

however i get this error:
SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at packageData (/home/kendell/Documents/Projects/SchoolHub/node_modules/undici/lib/fetch/body.js:524:19)
    at specConsumeBody (/home/kendell/Documents/Projects/SchoolHub/node_modules/undici/lib/fetch/body.js:488:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

any ideas on how to fix it? nothing else is logged
Was this page helpful?