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
Buffer is not defined when using @aws-crypto/client-browser in a Web Worker #1616
I have an Angular app using @aws-crypto/client-browser for decryption. It works fine in the main thread, but when I run it inside a Web Worker, I get: Uncaught ReferenceError: Buffer is not defined at build_cryptographic_key_helpers.js:6:21
This happens when calling: const { decrypt } = buildClient(CommitmentPolicy.REQUIRE_ENCRYPT_REQUIRE_DECRYPT);
Interestingly, Buffer.alloc() works when called directly in the worker, so it seems specific to how the SDK uses Buffer internally.
Possible Explanation
Since Buffer.alloc() works in the worker, this might be related to how the SDK bundles Buffer internally. Possibly Vite’s bundling behavior.
Activity
ShubhamChaturvedi7 commentedon Mar 10, 2026
Hi @karimaounn ,
We've released a fix in v4.2.2: https://www.npmjs.com/package/@aws-crypto/client-node/v/4.2.2?activeTab=versions