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.

chore: fix conflicts

jkomynoa56d427c5425
diff --cc ts/packages/core/src/utils/fileUtils.node.ts
index cd682db20,05c9c4097..3524b3ba5
--- a/ts/packages/core/src/utils/fileUtils.node.ts
+++ b/ts/packages/core/src/utils/fileUtils.node.ts
@@@ -169,31 -165,24 +169,28 @@@ const uploadFileToS3 = async
toolkit_slug: toolkitSlug,
});
- const { key, type } = response;
-
- if (type === 'new' || type === 'update') {
- logger.debug(`Uploading ${key} file to S3: ${key}`);
- const signedURL =
- response.type === 'update' ? response.update_presigned_url : response.new_presigned_url;
-
- // Create a new ArrayBuffer to ensure compatibility with fetch API
- const uploadBuffer = new ArrayBuffer(contentBytes.byteLength);
- new Uint8Array(uploadBuffer).set(contentBytes);
-
- const uploadResponse = await fetch(signedURL, {
- method: 'PUT',
- body: uploadBuffer,
- headers: {
- 'Content-Type': mimeType,
- 'Content-Length': contentBytes.length.toString(),
- },
- });
-
- if (!uploadResponse.ok) {
- throw new Error(`Failed to upload file to S3: ${uploadResponse.statusText}`);
- }
- } else {
- logger.debug(`File already exists in S3: ${key}`);
- const { key, new_presigned_url } = response;
++ const { key, new_presigned_url: signedURL } = response;
+
+ // Upload file using presigned URL
+ // Note: API now always returns type: 'new' with new_presigned_url
+ logger.debug(`Uploading ${key} file to S3: ${key}`);
- const buffer = Buffer.from(content, 'base64');
+
- const uploadResponse = await fetch(new_presigned_url, {
++ // 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: buffer,
++ body: bufferBase64,
+ headers: {
+ 'Content-Type': mimeType,
- 'Content-Length': buffer.length.toString(),
++ 'Content-Length': contentBytes.length.toString(),
+ },
+ });
+
+ if (!uploadResponse.ok) {
+ throw new Error(`Failed to upload file to S3: ${uploadResponse.statusText}`);
}
return key;