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

317
Views
Callback was already called Async Nodejs

I'm receiving this error with the Coalan Async library.

Error: (node:2172) UnhandledPromiseRejectionWarning: Error: Callback was already called.

Here is my code:

const updateOrCreateTrips = (trips, done) => {
  const Trip = mongoose.connection.db.collection(...);
    console.log(`updating or creating ${trips.length} trips`);
    async.eachLimit(trips, 100, (trip, next) => {
    const {...rest} = trip;
    console.log(`updating trip (${id}) ${title}`);

     const tripToUpdate = {//some data here...}
     Trip.update(
        {
          _id: trip.wordpressId,
        },
        {
          $set: tripToUpdate,
          $setOnInsert: {
            created: new Date(),
            enabled: true,
          },
        },
        {
          upsert: true,
        },
        next
    );
  }, done);
};
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!