-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix zlib polyfill -- was "Support for kafkajs package" #1811
Comments
Five possibilities come to mind:
|
After testing with another topic without compression, I found the origin of the issue, it's not working when trying to decode the GZIP stream. This code bellow is able to reproduce the error message (similar to https://github.com/tulios/kafkajs/blob/master/src/protocol/message/compression/gzip.js), but without kafkajs const { promisify } = require('util')
const zlib = require('zlib')
const gzip = promisify(zlib.gzip)
const unzip = promisify(zlib.unzip)
class Test {
static async compress(encoder: any) {
return await gzip(encoder)
}
static async decompress(buffer: any) {
return await unzip(buffer)
}
}
const buffer = await Test.compress('abc');
const decoded = await Test.decompress(buffer);
console.log({ r: buffer, A: decoded }); when running this, the message is a very long compressed code, followed by:
import zlib from 'zlib';
zlib.gzip('abc', (err, buffer) => {
if (err) throw 'encoder error: ' + err.message;
zlib.unzip(buffer, (err, decoded) => {
if (err) throw 'decode error error: ' + err.message;
console.log({ buffer: buffer, decoded: decoded.toString() });
});
}); kafkajs is working fine without the compression When trying to aff other compressions algorithms, such as zstd, it fails on
because I think bun does not support this binding yet |
oh yeah, our |
refer to >> #1511 |
What version of Bun is running?
0.5.0
What platform is your computer?
Linux 5.4.0-135-generic x86_64 x86_64
What steps can reproduce the bug?
Init a bun package, add kafkajs (tested on 2.2.3)
Trying to init a consumer results in
invalid input
error after joining the group:What is the expected behavior?
Read messages from the topic.
Topic was already created and poplated with data, compression is gzip.
I need to further test if producer/admin api is working with bun
What do you see instead?
No response
Additional information
Tested script:
index.ts
ENV KAFKA_VERSION 3.1.0
ENV SCALA_VERSION 2.13
The text was updated successfully, but these errors were encountered: