Skip to content

S3 cloud storage overwrites filesize to zero when editing an image #8108

Closed

Description

@cortopy

Link to reproduction

No response

Environment Info

Payload: 3.0.0-beta.100
Next js: 15.0.0-canary.137

Describe the Bug

When using @payloadcms/storage-s3 as media storage I've noticed that when I edit an existing file, the filesize database column gets overwritten to 0. This then shows in the frontend to as if the image has no bytes.

Reproduction Steps

  • Configure an upload collection with any text field (e.g.: name)
  • Configure @payloadcms/storage-s3 as media storage for that collection
  • Upload an image
  • Edit the text field (e.g.: name)
  • filesize will get written again to 0, removing valuable information about the file

Adapters and Plugins

@payloadcms/storage-s3

Activity

  1. added
    status: needs-triage
    on Sep 7, 2024
  2. github-actions commented on Dec 13, 2024

    @github-actions
    Contributor

    This issue has been marked as stale due to lack of activity.

    To keep this issue open, please indicate that it is still relevant in a comment below.

  3. cortopy commented on Dec 13, 2024

    @cortopy
    Author

    Still happening

  4. rob-at-cortex commented on Jan 8, 2025

    @rob-at-cortex

    has anyone got a resolution to this?
    some more detail from my perspective.. this does not happen for local storage. it starts happening when I switch to the s3 adaptor ( @payloadcms/storage-s3 ). I'm using @payloadcms/storage-s3 3.11.0

    when I upload an image initially everything is fine.
    Image

    the api looks like this... note the file size and mimeType

    {
    
        "id": 2,
        "alt": null,
        "prefix": "custom-images",
        "updatedAt": "2025-01-08T13:23:15.097Z",
        "createdAt": "2025-01-08T13:23:15.097Z",
        "url": "/api/images/file/iStock-1305515723.jpg",
        "thumbnailURL": "/api/images/file/iStock-1305515723-300x200.jpg",
        "filename": "iStock-1305515723.jpg",
        "mimeType": "image/jpeg",
        "filesize": 137620,
        "width": 2121,
        "height": 1414,
        "focalX": 50,
        "focalY": 50,
    
    "sizes": {
    
    "thumbnail": {
    
        "url": "/api/images/file/iStock-1305515723-300x200.jpg",
        "width": 300,
        "height": 200,
        "mimeType": "image/jpeg",
        "filesize": 5353,
        "filename": "iStock-1305515723-300x200.jpg"
    
    },
    "square": {
    
        "url": "/api/images/file/iStock-1305515723-500x500.jpg",
        "width": 500,
        "height": 500,
        "mimeType": "image/jpeg",
        "filesize": 22856,
        "filename": "iStock-1305515723-500x500.jpg"
    
    },
    "small": {
    
        "url": "/api/images/file/iStock-1305515723-600x400.jpg",
        "width": 600,
        "height": 400,
        "mimeType": "image/jpeg",
        "filesize": 16690,
        "filename": "iStock-1305515723-600x400.jpg"
    
    },
    "medium": {
    
        "url": "/api/images/file/iStock-1305515723-900x600.jpg",
        "width": 900,
        "height": 600,
        "mimeType": "image/jpeg",
        "filesize": 32947,
        "filename": "iStock-1305515723-900x600.jpg"
    
    },
    "large": {
    
        "url": "/api/images/file/iStock-1305515723-1400x933.jpg",
        "width": 1400,
        "height": 933,
        "mimeType": "image/jpeg",
        "filesize": 69422,
        "filename": "iStock-1305515723-1400x933.jpg"
    
    },
    
            "xlarge": {
                "url": "/api/images/file/iStock-1305515723-1920x1280.jpg",
                "width": 1920,
                "height": 1280,
                "mimeType": "image/jpeg",
                "filesize": 116051,
                "filename": "iStock-1305515723-1920x1280.jpg"
            }
        }
    
    }

    if I now edit the Alt text the UI shows the following..

    Image

    the API shows similar issues in the main metadata.

    {
    
        "id": 2,
        "alt": "alt",
        "prefix": "custom-images",
        "updatedAt": "2025-01-08T13:25:44.496Z",
        "createdAt": "2025-01-08T13:23:15.097Z",
        "url": "/api/images/file/iStock-1305515723.jpg",
        "thumbnailURL": "/api/images/file/iStock-1305515723-300x200.jpg",
        "filename": "iStock-1305515723.jpg",
        "mimeType": "text/html",
        "filesize": 2607,
        "width": 2121,
        "height": 1414,
        "focalX": 50,
        "focalY": 50,
    
    "sizes": {
    
    "thumbnail": {
    
        "url": "/api/images/file/iStock-1305515723-300x200.jpg",
        "width": 300,
        "height": 200,
        "mimeType": "image/jpeg",
        "filesize": 5353,
        "filename": "iStock-1305515723-300x200.jpg"
    
    },
    "square": {
    
        "url": "/api/images/file/iStock-1305515723-500x500.jpg",
        "width": 500,
        "height": 500,
        "mimeType": "image/jpeg",
        "filesize": 22856,
        "filename": "iStock-1305515723-500x500.jpg"
    
    },
    "small": {
    
        "url": "/api/images/file/iStock-1305515723-600x400.jpg",
        "width": 600,
        "height": 400,
        "mimeType": "image/jpeg",
        "filesize": 16690,
        "filename": "iStock-1305515723-600x400.jpg"
    
    },
    "medium": {
    
        "url": "/api/images/file/iStock-1305515723-900x600.jpg",
        "width": 900,
        "height": 600,
        "mimeType": "image/jpeg",
        "filesize": 32947,
        "filename": "iStock-1305515723-900x600.jpg"
    
    },
    "large": {
    
        "url": "/api/images/file/iStock-1305515723-1400x933.jpg",
        "width": 1400,
        "height": 933,
        "mimeType": "image/jpeg",
        "filesize": 69422,
        "filename": "iStock-1305515723-1400x933.jpg"
    
    },
    
            "xlarge": {
                "url": "/api/images/file/iStock-1305515723-1920x1280.jpg",
                "width": 1920,
                "height": 1280,
                "mimeType": "image/jpeg",
                "filesize": 116051,
                "filename": "iStock-1305515723-1920x1280.jpg"
            }
        }
    
    }
  5. self-assigned this
    on Feb 2, 2026
  6. removed
    status: needs-triage
    on Feb 2, 2026
  7. JessRynkar commented on Feb 2, 2026

    @JessRynkar
    Member

    Hi @cortopy and @rob-at-cortex, we recently pushed multiple updates related to the s3 adapter, some changes were related to this behavior (persisting metadata). Would you please retest on the latest version v3.74.0 and let me know if this issue is still occurring for either of you?

  8. added
    status: cant-reproduce
    on Feb 5, 2026
  9. JessRynkar commented on Feb 20, 2026

    @JessRynkar
    Member

    Since we haven’t heard back in a while and this issue relates to several releases ago, we’re going to close it for now. If you’re still seeing this behavior on the latest version (v3.77.0), please let me know and we can re-open this.

  10. removed
    status: cant-reproduce
    on Feb 20, 2026
  11. github-actions commented on Feb 28, 2026

    @github-actions
    Contributor

    This issue has been automatically locked.
    Please open a new issue if this issue persists with any additional detail.

  12. locked as resolved and limited conversation to collaborators on Feb 28, 2026
  13. self-assigned this
    on Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions