Why am I getting an InvalidChunkSizeError when using streamFileToS3?

This topic was automatically generated from Slack. You can find the original thread here.

I am using streamFileToS3 and I am getting the error InvalidChunkSizeError Only the last chunk is allowed to have a size less than 8192 bytes. Any idea why?

The error you’re encountering, InvalidChunkSizeError, typically occurs when streaming data to Amazon S3 using multipart uploads. This error indicates that chunks (or parts) of the file being uploaded to S3 must be at least 8192 bytes, except for the last chunk, which can be smaller. Here are a few steps you can take to resolve this issue: 1. Check Chunk Size: Ensure that each chunk you are uploading, except for the last one, is at least 8192 bytes. This is a requirement for S3 multipart uploads. 2. Adjust Buffer Size: If you’re using a buffer to read and upload data, make sure the buffer size is set to at least 8192 bytes. 3. Review Stream Logic: If you’re using a streaming library or custom logic to handle the upload, verify that the logic correctly handles the chunk sizes, especially ensuring that only the last chunk can be smaller than 8192 bytes. 4. Debugging: Add logging to your code to output the size of each chunk being uploaded. This can help identify if any chunks are incorrectly sized. If you continue to experience issues, you might want to review the specific implementation details of your streamFileToS3 function or consult the documentation for the library you’re using to ensure it supports the required chunk size for S3 uploads. If you need further assistance, please provide more details about your implementation or consider reaching out to Pipedream support at Support - Pipedream.

I am using the Premium version of AWS streamFileToS3, provided by Pipedream itself. And there is no option for chuckSize there… Any suggestion?

You should visit Pricing - Pipedream for the latest pricing, but I’ll do my best to answer. It seems you’re using the AWS integration in Pipedream to stream files to S3, and you’re looking for an option to set the chunkSize. Unfortunately, the current S3 - Stream file to S3 from URL action does not provide an option to specify the chunkSize directly. If you need to customize the chunkSize, you might consider implementing a custom solution using a Node.js code step in Pipedream. This would involve manually handling the file streaming process and specifying the chunkSize as needed. If you need further assistance or have specific requirements, I recommend reaching out to Pipedream support at Support - Pipedream for more detailed guidance.