Bedrock Runtime Converse SDK Document Block does not recognize Uint8Array() when reading PDF files #6774
Labels
bug
This issue is a bug.
p2
This is a standard priority issue
response-requested
Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Checkboxes for prior research
Describe the bug
Based on the AWS Bedrock Runtime SDK documentation, if a file is present in a message, it should be passed in as an Uint8Array, and the SDK will convert the Uint8Array into based 64 encoded string.
File upload is handled by middleware multer, I used the readFileSync method to read the PDF file as raw bytes and then convert it to an Uint8Array as shown in the code. However, it keeps emitting the error message Error: @smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array. I did a console.log() of the Uint8Array that I created, and I can confirm it is a Uint8Array; the SDK does not seem to recognize it for some reason. Thank you.
Regression Issue
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v20.8.1
Reproduction Steps
Observed Behavior
Error: @smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.
at toBase64 (/node_modules/@smithy/util-base64/dist-cjs/toBase64.js:15:15)
at Object.bytes (/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js:1810:41)
Expected Behavior
The AWS SDK should accept the document block with bytes in Uint8Array without any errors
Possible Solution
No response
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: