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

153
Views
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
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!