Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

335
Vistas
Axios "TypeError: Cannot read properties of undefined (reading 'then')" on request

I'm trying making a GET request using Axios to my Discord bot, but i'm getting a problem.

var axios = require("axios");
var response;

function getItemPrice(name, time) {
  axios.get("https://url.com/api/id=${name}&time=${time}")
}

response = getItemPrice("name", "time");

response.then(function(dataResponse){
  console.log(dataResponse.data);
}
).catch(function(error){
  if(error){
    console.log(error);
  }
});

I changed the URL. Show this in console ↓

TypeError: Cannot read properties of undefined (reading 'then')

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You have to use backticks (``) in URL to use template literals. And also use return from function getItemPrice.

Example:

axios.get(`https://url.com/api/id=${name}&time=${time}`)
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda