Baboo7 / strapi-plugin-import-export-entries

Import/Export data from and to your database in just few clicks.
179 stars 95 forks source link

[BUG] Media Upload tries to use the wrong id to insert to table #148

Closed tcherokee closed 10 months ago

tcherokee commented 1 year ago

Describe the bug I am uploading a collection of about 150 entries which have images (in an S3 bucket). Most of the images upload properly, however there are about 50 or so images that throw an error. A sample of the error can be seen below

    {
        "error": {
            "length": 182,
            "name": "error",
            "severity": "ERROR",
            "code": "23505",
            "detail": "Key (id)=(142) already exists.",
            "schema": "public",
            "table": "files",
            "constraint": "files_pkey",
            "file": "nbtinsert.c",
            "line": "671",
            "routine": "_bt_check_unique",
            "level": "\u001b[31merror\u001b[39m",
            "timestamp": "2023-10-25 21:52:42.589"
        },
        "data": {
            "id": 146,
            "url": "https://example.s3.amazonaws.com/images/thestatueofliberty.jpg"
        }
    }

it seems like it is trying to add the image with an id of 142, which already exists (a previous image which uploaded successfully). Instead of 146, which is what I defined in the JSON file. Here is a snippet of the relevant section

"plugin::upload.file": {
    ...
    "146": {
        "id": 146,
        "url": "https://example.s3.amazonaws.com/images/thestatueofliberty.jpg"
    }
    ...
}

I have even tried with a fresh install of strapi with no data, just in case it was something else that was causing it but I still ran into the error. I also updated my plugin to the latest version, also no success.

Additional context I am using the AWS-S3 provider plugin

tcherokee commented 1 year ago

Not sure if this helps, but images ids from I to 39 seemed to upload properly and then after that, every even id (i.e., 40, 42, 44 e.t.c) seemed to have an issue.

Baboo7 commented 11 months ago

@tcherokee checkout verson 1.22.1 where media import is much more stable