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

156
Vistas
Axios not returning response data

I have an axios post call that seems to be working find. The data is showing in console log fine and there are no errors in our Firebase functions log. However, we aren't returning the response object. The pubsub function finishes and moves onto the next doc. Any ideas on what I'm doing wrong? Code posted below.

exports.updateAllPayrollIds = functions.pubsub.schedule('every 1 minutes').onRun((context) => {
  return admin.firestore().collection('PS').orderBy("userId", "asc").startAt(1000)
     .get()
       .then(snapshot => {
        snapshot.forEach(doc => {
          let EncryptedSSN  = doc.data().ssn
          let decryptSSN  = CryptoJS.AES.decrypt(EncryptedSSN, '###########')
          var ssn = decryptSSN.toString(CryptoJS.enc.Utf8)
          var clientId = "###" 
          let docId = doc.data().id
          axiosInstance.request({
             url: 'https://apihost/getEmployeeBySSN',
             method: 'post',
             data: {ssn, clientId},
           })
             .then(response => {
               const data = response.data.employee.id;
               console.log('data', data);
               return admin.firestore().collection('PS').doc(docId).update({
               payrollId: data
     })
             }).catch(error => {
               console.log('getEmployeeBySSN error', error)
       
             })
      })
    })
    .catch(err => {
     console.log(err);
}) 
})
about 4 years ago · Juan Pablo Isaza
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