Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

675
Views
pasar al cuerpo una imagen base64 en fetch

Entonces, el título lo dice todo, estoy lidiando con este problema durante más de una semana, aquí está la cosa, quiero enviar a través de fetch "body" una base64 , aquí está mi código

 const response = await fetch("/api/ipfs", {method: "POST", body: image }); if (!response.ok) { throw new Error(`Error: ${response.status}`); } const result = await response.json() console.log(result.metadata)

la variable de imagen es una imagen base64. Cuando hago eso, sale este error .

 TypeError: Cannot read properties of undefined (reading 'length') at toUtf8Bytes (utf8.js?144e:176:21) at StringCoder.encode (string.js?2fad:12:48) at eval (array.js?4375:49:1) at Array.forEach (<anonymous>) at pack (array.js?4375:43:1) at TupleCoder.encode (tuple.js?1c6b:51:20) at AbiCoder.encode (abi-coder.js?2acc:87:1) at Interface._encodeParams (interface.js?1df7:254:1) at Interface.encodeFunctionData (interface.js?1df7:296:1) at eval (index.js?b70c:125:1) at Generator.next (<anonymous>) at fulfilled (index.js?b70c:5:43)

Sé que significa que los datos que estoy tratando de pasar deben estar en el formato correcto, pero ya intento pasar el base64 como una matriz, String, también agrego encabezados y uso formdata pero el error es el mismo. ¿Alguna idea?

Estoy usando NEXTjs con la API para buscarlo.

Funciona si paso una cadena normal, pero si paso una imagen base64, la genera.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!