sipcapture / hepfix.js

IPFIX Gateway for HEP & HOMER
http://sipcapture.org
MIT License
9 stars 2 forks source link

Fix restructure version #7

Closed mkpaz closed 11 months ago

mkpaz commented 11 months ago

Hello. Since restructure version isn't limited in package.json npm Uses recent 3.0.0 version which isn't compatible with Hepfix. It crashes on EncodeStream, because they made buffer a mandatory EncodeStream arg. Manually changing restructure version to 2.0.1 before build fixes the problem.

Oct 22 14:03:08 localhost.localdomain systemd[1]: hepfix.service: main process exited, code=exited, status=1/FAILURE
Oct 22 14:03:08 localhost.localdomain node[1745]: at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
Oct 22 14:03:08 localhost.localdomain node[1745]: at Socket.Readable.push (node:internal/streams/readable:228:10)
Oct 22 14:03:08 localhost.localdomain node[1745]: at readableAddChunk (node:internal/streams/readable:289:9)
Oct 22 14:03:08 localhost.localdomain node[1745]: at addChunk (node:internal/streams/readable:315:12)
Oct 22 14:03:08 localhost.localdomain node[1745]: at Socket.emit (node:events:513:28)
Oct 22 14:03:08 localhost.localdomain node[1745]: at Socket.<anonymous> (/opt/homer/hepfix/1.0.1/hepfix.js:247:2)
Oct 22 14:03:08 localhost.localdomain node[1745]: at fixHandler (/opt/homer/hepfix/1.0.1/hepfix.js:68:23)
Oct 22 14:03:08 localhost.localdomain node[1745]: at Object.exports.writeHandshake (/opt/homer/hepfix/1.0.1/sipfix.js:281:15)
Oct 22 14:03:08 localhost.localdomain node[1745]: at new $1ed46182c1410e1d$export$9b4f661deaa36c3e (/opt/homer/hepfix/1.0.1/node_modules/restructure/dist/main.cjs:110:46)
Oct 22 14:03:08 localhost.localdomain node[1745]: TypeError: Cannot read properties of undefined (reading 'buffer')
Oct 22 14:03:08 localhost.localdomain node[1745]: ^
Oct 22 14:03:08 localhost.localdomain node[1745]: this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
Oct 22 14:03:08 localhost.localdomain node[1745]: /opt/homer/hepfix/1.0.1/node_modules/restructure/dist/main.cjs:110
Oct 22 14:03:08 localhost.localdomain node[1745]: REPLYING WITH ID: 257
Oct 22 14:03:08 localhost.localdomain node[1745]: GOT HANDSHAKE ID:  256
Oct 22 14:02:57 localhost.localdomain node[1745]: HEPFIX.js Listening on port 4739 ...
lmangani commented 11 months ago

Thanks @mkpaz for the heads up! I'm surprised this is even still working. Fixed with https://github.com/sipcapture/hepfix.js/commit/4e850b4139da7dd9243d1b6aaa7b62eb23277414

mkpaz commented 11 months ago

It works fine. I'm also surprised to find such complex open source project that even supports proprietary hardware like Acme Packet. Thanks for you work!