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
{{ message }}
Repository navigation
Bug: Kafka consumer fails esbuild bundling unless unused Avro and Protobuf dependencies are installed #5557
A primitive-only consumer should bundle with only @aws-lambda-powertools/kafka installed. Format-specific dependencies and implementation code should only be required when Avro or Protobuf is configured.
Current Behavior
Using @aws-lambda-powertools/kafka@2.34.0 with primitive deserialization fails during esbuild bundling when avro-js and protobufjs are not installed.
The consumer dynamically imports all supported deserializers using literal paths. Esbuild resolves these modules during bundling, even though the handler does not configure Avro or Protobuf:
Could not resolve "protobufjs"
@aws-lambda-powertools/kafka/lib/esm/deserializer/protobuf.js:
import { BufferReader } from 'protobufjs';
Could not resolve "avro-js"
@aws-lambda-powertools/kafka/lib/esm/deserializer/avro.js:
import avro from 'avro-js';
The documentation indicates that these libraries are required only when their respective formats are used. They are also absent from the Kafka package’s dependencies and optional peer dependencies.
Installing both packages allows bundling, but esbuild includes both unused codec implementations in the single-file Lambda bundle because they remain runtime-selectable.
Occurs in invoking esbuild directly (see below) and CDK NodeJsFunctio bundling.
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out our GitHub Discussions: Join the conversation
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Activity
powertools-for-aws-oss-automation commentedon Aug 14, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out our GitHub Discussions: Join the conversation
fix(kafka): lazily import Avro and Protobuf codecs so JSON-only consu…
fix(kafka): lazily import Avro and Protobuf codecs so JSON-only consu…
fix(kafka): lazily import Avro and Protobuf codecs so JSON-only consu…
powertools-for-aws-oss-automation commentedon Aug 25, 2026
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
svozza commentedon Aug 25, 2026
This has been fixed in #5578.