-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Can't promisifyAll Riak-JS library #680
Comments
Doesn't reproduce with var Promise = require("bluebird");
var riak = require("riak-js")({});
Promise.promisifyAll(riak, { promisifier: function(originalFunction) {
return function() {
var args = [].slice.call(arguments);
var self = this;
return Promise.fromNode(function(callback) {
args.push(exports.wrapRiakCb(callback));
originalFunction.apply(self, args);
});
};
}}); |
@ryanmeador anything? |
I apologize for not getting back to you sooner, I was on vacation. I still see the problem, so I spent some time coming up with a minimal reproducer. My mind is blown. The problem only manifests if I Because I can't seem to attach a ZIP to this issue, I created a repo for my reproducer: https://github.com/ryanmeador/bluebird680reproducer Please note that, as specified in the package.json, the version of neo4j that causes the error must be 1.x (or at least not latest). I have no idea what is going on. Thanks for your attention so far. |
I'm trying to promisifyAll the riak client object exposed by the riak-js library, version 1.0.3. I just upgraded Bluebird from 2.9.25 to 2.9.30. There was no problem with the older version. Now I get this error message. I cannot find any method that violates the signature in the riak docs, nor by hand-inspecting the object in question. I added a log statement into Bluebird at promisify.js:46 to print out the value that was failing the check, and it says "apply_" (btw, I think it would be great if the error message included this information). I am unaware of any such function on the riak object so I have no idea what is going on... can you offer any help debugging, or is this perhaps a bug in Bluebird? Thanks.
Edit: I should have mentioned I have created my own promisifier, because all Riak functions' callbacks take 3 arguments (err, result, meta), and I want to discard the meta parameter because it seems to cause issues with Promise (I guess it passes an array or something to the next function in the chain? I didn't try to debug that; I had the same issue with Async before switching to promises and I solved it just by discarding the meta param). Here's my promisifier, where
riak
is a riak client object andwrapRiakCb
is the function that drops the meta param:The text was updated successfully, but these errors were encountered: