vienthuong / shopware-php-sdk

A PHP SDK for Shopware 6 Admin API
MIT License
112 stars 44 forks source link

Transaction commit failed because the transaction has been marked for rollback only #72

Closed gaxweb closed 1 year ago

gaxweb commented 1 year ago
{
    "extensions": [],
    "success": false,
    "data": [
        {
            "extensions": [],
            "result": [
                {
                    "entities": [],
                    "errors": [
                        {
                            "code": "0",
                            "status": "500",
                            "title": "Internal Server Error",
                            "detail": "Transaction commit failed because the transaction has been marked for rollback only."
                        }
                    ]
                }
            ]
        }
    ],
    "deleted": [],
    "notFound": []
}

I'm not sure where exactly that error's coming from, but I know that I'm stuck because I have no idea how to rectify that. Any ideas? I was POST'ing a product upsert to /api/_action/sync and that's what came up after fixing some complaints about missing fields and whatnot. I'm using shopware-sdk "^1.7.3" and SW 6.4.20.

slemke76 commented 1 year ago

Hello,

I have a very similar issue; I am also using /api/_action/sync call. Please try to add this header: indexing-behavior: use-queue-indexing - see https://shopware.stoplight.io/docs/admin-api/faf8f8e4e13a0-bulk-payloads#performance

If it will be successfull (for me it works - EDIT: Not all the time, but almost), we have the same issue - something with indexing. I actually do not know the real cause, but it´s a hint into (hopefully) the right direction.

Sebastian

gaxweb commented 1 year ago

I know now that the problem was a DB index constraint violation. A record with the same ID already existed, but I can't say for sure which one.

slemke76 commented 1 year ago

Hello,

can you give me additional infos how you find that out and (the most important thing :-)) how to fix that problem? That would be very helpful for me... Thanks a lot!

Thanks Sebastian

gaxweb commented 1 year ago

Unfortunately I can't. I used a debugger to see where the exception was thrown, and then took it from there. Changed some stuff around that looked suspicious and eventually got it right…

vienthuong commented 1 year ago

Seems like the bug is resolved? Feel free to reopen it when you know the steps to reproduce