0

I'm just trying to generate a user during the bootstrap process.

I hit his update statement and the process stops, then times out after 10 seconds with "Bootstrap is taking unusually long to execute its callback (10000 milliseconds)." Update error is never thrown. I know the user exists. I've checked before attempting update.

User.update({id:id}, {verificationCode: verificationCode})
    .then(function(updatedUser){
        console.log("VerificationCode added.", updatedUser);
        addInitialPermissions();
    })
    .catch(function(err){
        if(err) throw new Error(err);
        next(err);
    });

I have no clue what the problem can be. Would appreciate any help.

thanks

Rob
  • 14,746
  • 28
  • 47
  • 65
mryarbles
  • 378
  • 2
  • 8

1 Answers1

1

This is wrong:

User.update({id:id}, {verificationCode: verificationCode})
    .then(function(updatedUser){
        console.log("VerificationCode added.", updatedUser);
        addInitialPermissions();
    })
    .catch(function(err){
        if(err) throw new Error(err);
        next(err);
    });

This is correct, exec , not then:

User.update({id:id}, {verificationCode: verificationCode})
    .exec(function(err, updatedUser){
    if(err) {
     console.log(err)
    return;
    }
        console.log("VerificationCode added.", updatedUser);
        addInitialPermissions();
    });
Marek Urbanowicz
  • 12,659
  • 16
  • 62
  • 87