@aws-sdk/client-kms : Error decrypting data: TypeError: Cannot read properties of undefined (reading 'byteLength') #5202
Replies: 2 comments 1 reply
-
Hi @DhirajAswani, can you please let me know which SDK minor version are you using?. If is not the latest version of the SDK, would you be able to please update to the latest and see if the behavior persist there?. The current latest version is v3.411.o as of today. Please let me know. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hello All, `async function encrypt(event, context) {
}` |
Beta Was this translation helpful? Give feedback.
-
I am using s3 and kms with aws-sdk v3 nodejs 18.
I have uploaded a file to s3 with this command - aws s3 cp config.json s3://lambda-config --sse aws:kms --sse-kms-key-id "my_kms_key_id"
So now I have a file with name - config.json in S3 bucket (lambda-config)
Now I am trying to fetch config.json file from S3 and decrypt with KMS using AWS-SDK v3 in nodejs 18
ERROR:
Error decrypting data: TypeError: Cannot read properties of undefined (reading 'byteLength')
at fromArrayBuffer (/Users/daswani/node_modules/@smithy/util-buffer-from/dist-cjs/index.js:6:60)
at toBase64 (/Users/daswani/node_modules/@smithy/util-base64/dist-cjs/toBase64.js:5:68)
at applyInstruction (/Users/daswani/node_modules/@smithy/smithy-client/dist-cjs/object-mapping.js:73:33)
at take (/Users/daswani/node_modules/@smithy/smithy-client/dist-cjs/object-mapping.js:44:9)
at se_DecryptRequest (/Users/daswani/node_modules/@aws-sdk/client-kms/dist-cjs/protocols/Aws_json1_1.js:3327:37)
at se_DecryptCommand (/Users/daswani/node_modules/@aws-sdk/client-kms/dist-cjs/protocols/Aws_json1_1.js:54:27)
at serialize (/Users/daswani/node_modules/@aws-sdk/client-kms/dist-cjs/commands/DecryptCommand.js:41:52)
at /Users/daswani/node_modules/@smithy/middleware-serde/dist-cjs/serializerMiddleware.js:12:27
at /Users/daswani/node_modules/@smithy/middleware-endpoint/dist-cjs/endpointMiddleware.js:20:16
Code Example for above error
Beta Was this translation helpful? Give feedback.
All reactions