You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#11 was caused by attempting to read the offset and size from the buffer without checking that there were enough bytes in the buffer. The fix was to simply do that check first:
`Tried to decode a partial message: There isn't enough bytes to read the offset`
)
}
constoffset=decoder.readInt64().toString()
However, we don't want to have to do these checks manually everywhere we try to read from a buffer. We could check the buffer size in the decoder itself, but it doesn't have the knowledge about messages etc, so it would just be able to throw very generic errors.
The suggestion is to never use theDecoder directly, but rather create specific decoders for what we are trying to decode, for example MessageDecoder, which can call the primitive methods on the Decoder, catch the generic errors and re-throw more specific ones.
The text was updated successfully, but these errors were encountered:
#11 was caused by attempting to read the offset and size from the buffer without checking that there were enough bytes in the buffer. The fix was to simply do that check first:
kafkajs/src/protocol/messageSet/decoder.js
Lines 68 to 74 in 01345c9
However, we don't want to have to do these checks manually everywhere we try to read from a buffer. We could check the buffer size in the decoder itself, but it doesn't have the knowledge about messages etc, so it would just be able to throw very generic errors.
The suggestion is to never use the
Decoder
directly, but rather create specific decoders for what we are trying to decode, for exampleMessageDecoder
, which can call the primitive methods on theDecoder
, catch the generic errors and re-throw more specific ones.The text was updated successfully, but these errors were encountered: