Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some bluebird warinings with un-returned promise #4

Open
deksden opened this issue Jun 26, 2017 · 0 comments
Open

Some bluebird warinings with un-returned promise #4

deksden opened this issue Jun 26, 2017 · 0 comments

Comments

@deksden
Copy link

deksden commented Jun 26, 2017

I ve got some bluebird warnings like "Warning: a promise was created in a handler at ... but none were returned from it" - for ex, code in auth.js:

const strategy = new Strategy(params, (payload, done) => {
    Users.findById(payload.id)
        .then(user => {
          if (user) {
            return done(null, { // << -- here is problem
              id: user.id,
              email: user.email,
            });
          }
          return done(null, false);
        })
        .catch(error => done(error, null));
  });

Here is explanation of problem in issue thread: petkaantonov/bluebird#508

Possible fix:

const strategy = new Strategy(params, (payload, done) => {
    Users.findById(payload.id)
        .then(user => {
          if (user) {
            return { // << -- fix 
              id: user.id,
              email: user.email,
            });
          }
          return false;
        })
        .asCallback(done)
        .catch(error => done(error, null));
  });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant