Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(ts/core): remove base64 to Uint8Array buffer, fix corrupted files (#2531)

Alberto Schiabele74638358051
diff --git a/.changeset/nice-months-cut.md b/.changeset/nice-months-cut.md
new file mode 100644
index 000000000..fe6fd04d7
--- /dev/null
+++ b/.changeset/nice-months-cut.md
@@ -0,0 +1,5 @@
+---
+'@composio/core': patch
+---
+
+Fix issues with file upload corruption
diff --git a/ts/packages/core/src/utils/fileUtils.node.ts b/ts/packages/core/src/utils/fileUtils.node.ts
index 3524b3ba5..658ab70bf 100644
--- a/ts/packages/core/src/utils/fileUtils.node.ts
+++ b/ts/packages/core/src/utils/fileUtils.node.ts
@@ -178,11 +178,10 @@ const uploadFileToS3 = async (
// Create a new ArrayBuffer to ensure compatibility with fetch API
const uploadBuffer = new Uint8Array(contentBytes.byteLength);
uploadBuffer.set(contentBytes);
- const bufferBase64 = uint8ArrayToBase64(uploadBuffer);
const uploadResponse = await fetch(signedURL, {
method: 'PUT',
- body: bufferBase64,
+ body: uploadBuffer,
headers: {
'Content-Type': mimeType,
'Content-Length': contentBytes.length.toString(),