3

I use iron.io to call the following parse.com function to get Facebook details of my user's friends.

var getDetailsForID = function (fbID) {

var thePromise = new Parse.Promise();

// TODO: maybe we can batch several users together into a single request................
console.log("Enter getDetailsForID");
FB.api('/v1.0', 'post', { 
    batch: [
        { method: 'get', name: 'basic',      relative_url: fbID + '?fields=id,name,gender&include_headers=false', omit_response_on_success: false },
    ]
}, function(res) {
    console.log("Enter callback in getDetailsForID");
    if(!res || res.error) {
        console.log(!res ? 'error occurred' : res.error);
        return;
    }

    console.log(" getDetailsForID res: " + res);
    thePromise.resolve(res);
});


console.log("Exit getDetailsForID");
return thePromise;
}

In the iron.io log I see:

Enter callback in getDetailsForID
[Error: 139994800940864:error:0607907F:digital envelope routines:EVP_PKEY_get1_RSA:expecting an rsa key:../deps/openssl/openssl/crypto/evp/p_lib.c:288:

The following are not called:

console.log(" getDetailsForID res: " + res);
    thePromise.resolve(res);

Any idea how to resolve this problem?

Pang
  • 9,564
  • 146
  • 81
  • 122
NatashFine
  • 31
  • 2

2 Answers2

1

Since the answer to this question, IronWorker has released a Docker workflow. Feel free to use our official iron/node Docker Image. https://github.com/iron-io/dockerworker/tree/master/node

0

Ahh this is definitely not a problem with Iron.io but a problem with your post to the Facebook v1.0 API call.

+ '?fields=id,name,gender&include_headers=false', omit_response_on_success: false

do you really want to omit response on success? Which Facebook endpoint are you sending a Post to?

edit
IronWorker is currently set to 0.10.25 as of 07/22/2014, Use if your node version is < 0.10.25 you may receive this error.

fix: load your own version of node in your .worker file add the following

deb "http://ppa.launchpad.net/chris-lea/node.js/ubuntu/pool/main/n/nodejs/nodejs_0.10.29-1chl1~trusty1_amd64.deb" 

# OR you can download it from a local copy

deb "nodejs_0.10.29-1chl1~trusty1_amd64.deb"

You can install other missing or updated versions of binaries in a similar manner if there is a .deb for it.

Example in practice here on github

tldr. use latest version of node, possibly openssl also.

Stephen Nguyen
  • 5,357
  • 5
  • 24
  • 28
  • omit_response_on_success: false, if it was "true" I would have agree with you :) – NatashFine Jul 23 '14 at 08:41
  • 1
    Hi Stephen and thanks for answering. When running the same Facebook request using non iron.io server, we get a positive answer. From my examinations the only cause for this problem is an old node.js version. See here for example - https://github.com/jaredhanson/passport-facebook/issues/90 and please check iron.io node js version. The problem was fixed after version 0.10. – NatashFine Jul 23 '14 at 14:48
  • I've tried what you suggested: deb "http://ppa.launchpad.net/chris-lea/node.js/ubuntu/pool/main/n/nodejs/nodejs_0.10.29-1chl1~trusty1_amd64.deb" There was a remote build: fetch_FB_details::builder, but nothing changed, I still get the same error. Can you please update openssl? – NatashFine Jul 24 '14 at 07:57
  • try adding deb "http://ftp.us.debian.org/debian/pool/main/o/openssl/openssl_1.0.1e-2+deb7u11_amd64.deb" – Stephen Nguyen Jul 24 '14 at 10:03
  • to check node version in your worker console.log(process.version) – Stephen Nguyen Jul 24 '14 at 10:06
  • to check openssl version and if it installed correctly you need to run a shell command in node. var sys = require('sys') var exec = require('child_process').exec; function puts(error, stdout, stderr) { sys.puts(stdout) } exec("openssl version", puts); // i need to verify correct usage on child_process's exec function http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback – Stephen Nguyen Jul 24 '14 at 10:10
  • Iv'e checked the node version, it's: v0.8.8. I can't update it, you have to do it! – NatashFine Jul 24 '14 at 11:48
  • adding the this to your .worker file will update our runtime to recent version of node. stack "node-0.10*" come jump on our live chat here https://www.hipchat.com/gym1ayjWj – Stephen Nguyen Jul 24 '14 at 21:09