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

131
Views
Errores al usar la función fetch (JavaScript)

Estoy trabajando con AWS API Gateway y recibo el siguiente error:

TypeError no detectado TypeError: no se pudo recuperar

Mi API solo devuelve una cadena JSON simple. Puedo obtener una respuesta exitosa con curl, Postman y pruebas a través de la consola de AWS. Pero, al usar JavaScript, aparece un error. Sospecho que AWS requiere un encabezado específico

Separé el código del sitio web original. Se han eliminado algunas partes innecesarias.

 <script type = "text/javascript"> const GET_url = '<url>' const POST_url = '<url>' async function getInvokeFromAPI() { const response = await fetch(GET_url, { method: 'GET' }); const data = await response.json(); } async function postInvokeFromAPI() { const respone = await fetch(POST_url, { method: 'POST', headers: { 'Content-Type': 'application/json', } }); const data = await response.json(); } </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Sería útil ver la salida de la consola cuando ocurre el error.

Pero si funciona con Postman y no con la API de búsqueda, probablemente tenga un error de CORS.

Puede consultar esta página de MDN para obtener más información sobre CORS en caso de que sea su error: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Si es su error, se registrará en la consola del navegador en las herramientas de desarrollo.

about 4 years ago · Juan Pablo Isaza Report
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!