Giter Site home page Giter Site logo

Does not work on node 18 about kafkajs-lz4 HOT 11 OPEN

indix avatar indix commented on June 18, 2024 6
Does not work on node 18

from kafkajs-lz4.

Comments (11)

mark-b-ab avatar mark-b-ab commented on June 18, 2024 4

One more workaround

//Explanation: https://github.com/ukyo/lz4.js/issues/14
const originalFetch = global.fetch;
global.fetch = undefined;
const LZ4 = require('kafkajs-lz4');
global.fetch = originalFetch;

CompressionCodecs[CompressionTypes.LZ4] = new LZ4().codec;

from kafkajs-lz4.

mark-b-ab avatar mark-b-ab commented on June 18, 2024 1

You can try to write your own wrapper around other lz4 library or switch to snappy as we did

from kafkajs-lz4.

eau-de-la-seine avatar eau-de-la-seine commented on June 18, 2024

Hi, this workaround doesn't work for me and I still get the same error, I think it's because I use esbuild, all the require() are called first!

I don't know if the authors still work on this project (last commit was +2 years ago), but yeah the lib is broken for Nodejs18

from kafkajs-lz4.

eau-de-la-seine avatar eau-de-la-seine commented on June 18, 2024

Oh hi @mark-b-ab, thanks! I don't like workarounds and I was not going back to NodeJSv16 because an old lib will probably never get updated, so I have switched to Snappy too even if I have hesitated with the ZSTD!

NB: Despite having compression.type=producer by default at broker-side, I haven't noticed any compression optimization by Snappy with the kafkajs client though (the last commit on the Snappy lib is +4y)

from kafkajs-lz4.

jimmywarting avatar jimmywarting commented on June 18, 2024

bump

from kafkajs-lz4.

athira009 avatar athira009 commented on June 18, 2024

Hi all, I am getting the same error for all node versions of 18 or higher. Also, I cannot able to use snappy. Is there any other alternative for this?

from kafkajs-lz4.

Marko298 avatar Marko298 commented on June 18, 2024

Hi all, I am getting the same error for all node versions of 18 or higher. Also, I cannot able to use snappy. Is there any other alternative for this?

Use workarounds. Works fine, running in prod, all good

from kafkajs-lz4.

athira009 avatar athira009 commented on June 18, 2024

Hi @Marko298 , thanks for the quick reply. Could you specify the workarounds?

from kafkajs-lz4.

Marko298 avatar Marko298 commented on June 18, 2024

Hi @Marko298 , thanks for the quick reply. Could you specify the workarounds?

#16 (comment)

from kafkajs-lz4.

athira009 avatar athira009 commented on June 18, 2024

That didn't work @Marko298

from kafkajs-lz4.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.