Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amplify Storage uploads objects to S3 at a reduced size #12988

Closed
4 tasks done
buildforprod opened this issue Nov 7, 2023 · 5 comments
Closed
4 tasks done

Amplify Storage uploads objects to S3 at a reduced size #12988

buildforprod opened this issue Nov 7, 2023 · 5 comments
Assignees
Labels
question General question Storage Related to Storage components/category transferred This issue was transferred from another Amplify project

Comments

@buildforprod
Copy link

buildforprod commented Nov 7, 2023

Before opening, please confirm:

App Id

d21kc3ho29wsqv

AWS Region

us-east-1

Amplify Hosting feature

Not Applicable

Question

I'm observing that objects uploaded to S3 using Amplify Storage are stored at a reduced size! The code for uploading the objects is working fine when tested outside of Amplify.

The code used in React:

const [files, setFiles] = useState([]);
const handleDrop = async (e) => {
        e.preventDefault();
        const newFiles = [...files];
        for (let i = 0; i < e.dataTransfer.files.length; i++) {
            const file = e.dataTransfer.files[i];
            newFiles.push({ key: file.name, file });
        }
        setFiles(newFiles);
    };

const handleUpload = async () => {
        for (const file of files) {
            const result = await Storage.put(`${city}/${resource}/${file.key}`, file, {
                contentType: file.file.type, });
        }
    };
@buildforprod buildforprod added the question General question label Nov 7, 2023
@Jay2113
Copy link

Jay2113 commented Feb 8, 2024

Hi @buildforprod 👋 , thanks for reaching out. Since the issue seems related to the Amplify Storage category/library, I am going to transfer this over to the amplify-js repository for better assistance.

@Jay2113 Jay2113 transferred this issue from aws-amplify/amplify-hosting Feb 8, 2024
@Jay2113 Jay2113 added the transferred This issue was transferred from another Amplify project label Feb 8, 2024
@nadetastic nadetastic self-assigned this Mar 5, 2024
@nadetastic nadetastic added Storage Related to Storage components/category investigating This issue is being investigated labels Mar 5, 2024
@nadetastic
Copy link
Member

HI @buildforprod I'm currently investigating this and will follow up soon. In the meantime let me know if there have been any updates or additional context to provide.

@nadetastic
Copy link
Member

Hi @buildforprod following up here - this isn't something that the library is doing after doing some investigation. As seen on this thread, this can be the result of s3 not working like a traditional filesystem and rather uses a key and prefix patterns for storage and all permission related information and metadata is controlled at the bucket level along with AWS IAM which is Identity and Access Management system. Hence, we observe this difference in object size.

@nadetastic nadetastic added pending-response and removed investigating This issue is being investigated labels Mar 6, 2024
@cwomack
Copy link
Member

cwomack commented Mar 29, 2024

@buildforprod, wanted to check in and see if you're still experiencing this issue. Let us know if you got a chance to review the comment above and have any additional questions. Thanks!

@cwomack
Copy link
Member

cwomack commented Apr 4, 2024

Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.

Thank you!

@cwomack cwomack closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General question Storage Related to Storage components/category transferred This issue was transferred from another Amplify project
Projects
None yet
Development

No branches or pull requests

4 participants