Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work on node 18 #16

Open
mark-b-ab opened this issue Nov 3, 2022 · 12 comments
Open

Does not work on node 18 #16

mark-b-ab opened this issue Nov 3, 2022 · 12 comments

Comments

@mark-b-ab
Copy link

Explanation here ukyo/lz4.js#14 (comment)

Error for Google index: TypeError: Failed to parse URL from /Users/mark/Phpstorm/dtq/node_modules/lz4-asm/dist/_lz4.wasm

@mark-b-ab
Copy link
Author

mark-b-ab commented Nov 3, 2022

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;

@eau-de-la-seine
Copy link

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

@mark-b-ab
Copy link
Author

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

@eau-de-la-seine
Copy link

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)

@jimmywarting
Copy link

bump

@athira009
Copy link

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?

@Marko298
Copy link

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

@athira009
Copy link

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

@Marko298
Copy link

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

#16 (comment)

@athira009
Copy link

That didn't work @Marko298

@simyara
Copy link

simyara commented May 29, 2024

bump

1 similar comment
@tjfrisch-swa
Copy link

bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants