Kafka-node: snappy buffer.from typeError: this is not type array

Created on 2 Aug 2017  路  5Comments  路  Source: SOHU-Co/kafka-node

hi.. i get error when i run producer_nodejs.js.
how i solve this error??

$ node producer_nodejs.js
/home/nurika/Apps/kafkanode/node_modules/kafka-node/lib/codec/snappy.js:18
var SNAPPY_MAGIC = Buffer.from(SNAPPY_MAGIC_BYTES).toString('hex');
^

TypeError: this is not a typed array.
at Function.from (native)
at Object. (/home/nurika/Apps/kafkanode/node_modules/kafka-node/lib/codec/snappy.js:18:29)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/home/nurika/Apps/kafkanode/node_modules/kafka-node/lib/codec/index.js:4:19)
at Module._compile (module.js:410:26)

compression

Most helpful comment

@AnnisaNurika You may want to update your Node version to 6.

All 5 comments

I haven't seen this before. But I plan on looking into compression issues after the Streaming stuff is done.

@AnnisaNurika You may want to update your Node version to 6.

Yes, I also had the same problem with Node Version v4.1.0. Then I updated to current stable version v8.9.3. Now it is solved.

Looks like Buffer constructors was backported in v4.5.0. So the latest Latest v4.x should also work.

Either increase the node version above 4.5 or
use "kafka-node": "1.6.2"

Cheers
Happy coding

Was this page helpful?
0 / 5 - 0 ratings