mcollina / ponte

The M2M/IoT Bridge for REST developers
51 stars 5 forks source link

Eclipse ponte not working with node v0.12.0 #5

Closed tucanae47 closed 9 years ago

tucanae47 commented 9 years ago

First at all this issue was found on the current version of Official ponte server , but i dont understand why you guys didn't enable github issue tracker on eclipse ponte...

Now the issue:

I was not able to run ponte correctly on 2 machines, here is the environments i tested and how i arrive to a solution (or a workaround i think).

1. OSX Mavericks
uname -a 
Darwin camilos-mbp.lan 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
OS X 10.9.5 (13F34)
node -v 
v0.12.0

2. Xubuntu
uname -a 
Linux ##### 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID:    Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:    trusty
node -v 
v0.12.0

3. AWS Linux EC2 instance
Amazon Linux AMI release 2014.09
Kernel \r on an \m
uname -a 
Linux ip-###-##-##- 3.14.27-25.47.amzn1.x86_64 #1 SMP Wed Dec 17 18:36:15 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
node -v 
v0.10.33

on these environments installations tested were

npm install -g ponte bunyan 
###and
git clone https://github.com/eclipse/ponte
npm install

issues i found on environments 1 and 2: Issue 1 During installation it shows lots of errors related with node-gyp build so to solve all those errors except zmq i did:

//old pakage json
"mosca": "~0.26.2",
"ascoltatori": "~0.18.0",
"mqtt": "~0.3.11"
//new package json:
"mosca": "~0.28.1",
"ascoltatori": "~0.20.0"
"mqtt": "~1.0.0"

Issue 2 Even with the install errors it was possible to start the server, but i was not able to return correctly calls to the mqtt broker, and also i wasn't getting coap response to the coap-cli, neither to an android coap client, it was receiving the CoAp request, but it never returned a CoAp response.

The interesting fact was that on environment 3.... i did normal installation process with npm install -g ponte bunyan , and with this version everything was working out of the box, then i tried exactly same node version on environments 1, 2 and also in a docker instance with no success....So i started debugging and at this point i realised what the problem is:

callback-stream is not working correctly

I think is related with the stream libraries that are out of date, im not sure yet.. as you can see in a fork i did of callback stream, i added a line inside the pipe, and this did the trick, everything works now on all environments. but im not sure if this is the correct thing to do, would you please help me?

 this.once("pipe", function(source) {
+    callback(null, this.results)
     source.on("error", callback);
   })
 }

https://github.com/tucanae47/callback-stream/commit/4669de833a938e3f8ff4212323dae79a8793897d

Ps. From my debugging i also found that call-backstream is using var Writable = require("stream").Writable, not readable-stream

mcollina commented 9 years ago
  1. Eclipse forbids to use the issue tracker in Github.

I am releasing a new version later today, can you please check locally?

mcollina commented 9 years ago

The latest master is working on node 0.12 and latest iojs