Skip to content

Cant complete webapi log save because of error: There is no active transaction #12

@adamwaclawczyk

Description

@adamwaclawczyk

We have encountered an error when using standard Magento 2 webapi urls e.g. rest/V1/products/sku/media
Below are the related logs. I have fixed this via early return on \GhostUnicorns\WebapiLogs\Model\LogHandle::after and later via disabling this module. There were no more issues with disabled module - so I suspect a deeper analysis is required for this module to work without below errors.
M2 version: 2.4.8
PHP version: 8.3
DB: 11.4.7-MariaDB-ubu2404

[2025-08-04T06:37:03.961388+00:00] GhostUnicorns::WebapiLogs.ERROR: Cant complete webapi log save because of error: There is no active transaction [] []
[2025-08-04T06:42:19.821691+00:00] GhostUnicorns::WebapiLogs.ERROR: Cant complete webapi log save because of error: There is no active transaction [] []
[2025-08-04T06:46:13.553723+00:00] GhostUnicorns::WebapiLogs.ERROR: Cant complete webapi log save because of error: There is no active transaction [] []
[2025-08-04T06:58:46.199912+00:00] GhostUnicorns::WebapiLogs.ERROR: Cant complete webapi log save because of error: There is no active transaction [] []

<b>Fatal error</b>:  Uncaught Exception: User Error: Some transactions have not been committed or rolled back in .../vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 4228 in .../vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(256, 'Some transactio...', '/var/www/test.s...', 4228)
#1 .../vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(4228): trigger_error('Some transactio...', 256)
#2 [internal function]: Magento\Framework\DB\Adapter\Pdo\Mysql->__destruct()
#3 {main}
  thrown in <b>.../vendor/magento/framework/App/ErrorHandler.php</b> on line <b>61</b><br />

Metadata

Metadata

Assignees

No one assigned

    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