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

TypeError: Cannot set property '_bitField' of undefined #1320

Closed
Shrivallabh opened this issue Jan 15, 2017 · 3 comments
Closed

TypeError: Cannot set property '_bitField' of undefined #1320

Shrivallabh opened this issue Jan 15, 2017 · 3 comments

Comments

@Shrivallabh
Copy link

@Shrivallabh Shrivallabh commented Jan 15, 2017

I am using bluebird 3.4.6.

I am making a call to kafka which is wrapped inside a promise. The promise is resolved if the message is published. The promise is rejected if the call to kafka fails.

Here is the piece of code that is causing the error -


redis.get(something)
.then(function() { 
            return Promise(function(resolve, reject) { // This is Line 98 in the stacktrace
                producer.send([
                    {
                        topic : "Ganga",
                        messages : [JSON.stringify({// some object})]
                    }
                ], function(err, data) {
                    if(err) {
                        logger.error("Error")
                        logger.error(err);
                        reject(err);
                        return;
                    }
                    resolve(data);
                })
            });
        })

The stacktrace is as follows

TypeError: Cannot set property '_bitField' of undefined
    at <project base path>/index.js:98:20
    at bound (domain.js:280:14)
    at runBound (domain.js:293:12)
    at runCallback (timers.js:649:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)
From previous event:
    at Server.<anonymous> (<project base path>/index.js:97:10)
    at next (<project base path>/node_modules/restify/lib/server.js:912:30)
    at f (<project base path>/node_modules/once/once.js:25:25)
    at Server.parseBody (<project base path>/node_modules/restify/lib/plugins/body_parser.js:94:13)
    at next (<project base path>/node_modules/restify/lib/server.js:912:30)
    at f (<project base path>/node_modules/once/once.js:25:25)
    at IncomingMessage.done (<project base path>/node_modules/restify/lib/plugins/body_reader.js:121:13)
    at IncomingMessage.g (events.js:292:16)
    at emitNone (events.js:86:13)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

Any suggestion on what could be wrong?

@benjamingr
Copy link
Collaborator

@benjamingr benjamingr commented Jan 15, 2017

You're missing new before Promise, but that's not the error I'd expect you to get.

Loading

@sankargorthi
Copy link

@sankargorthi sankargorthi commented Jan 26, 2017

Ran into the same error today when I accidentally did this:

const coroutine = require('bluebird');

coroutine(function* () {
    yield foo();
    ...
});
TypeError: Cannot set property '_bitField' of undefined
         at Promise (/<snip>/node_modules/bluebird/js/release/promise.js:70:20)
         at ...

(instead of :

const {coroutine} = require('bluebird');
...

)

Loading

@IsaiahJTurner
Copy link

@IsaiahJTurner IsaiahJTurner commented Feb 6, 2017

I ran into this when I did
const Promise = require('bluebird')(); instead of const Promise = require('bluebird/js/release/promise')();.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants