0

Klarna cron to clean the log throws the error and cron job failed:

Table: cron_schedule

job_code : klarna_core_clean_logs

Error: 'SQLSTATE[42S22]: Column not found: 1054 Unknown column ''store_id'' in ''where clause'', query was: SELECT COUNT(*) FROM `klarna_logs` AS `main_table` WHERE (`store_id` = ''0'') AND (`created_at` <= ''2021-07-14'')'

1 Answer 1

2

I See, vendor/klarna/module-core/etc/db_schema.xml does not have store_id in the "column" tag But " $logs->addFieldToFilter('store_id', $store->getId());" in vendor/klarna/module-core/Cron/CleanLogs.php:141

I think this causes the error in cron jobs.

Created a patch file to resolve this issue

diff --git a/vendor/klarna/module-core/Cron/CleanLogs.php b/vendor/klarna/module-core/Cron/CleanLogs.php
index a2910a8..28f684c 100644
--- a/vendor/klarna/module-core/Cron/CleanLogs.php
+++ b/vendor/klarna/module-core/Cron/CleanLogs.php
@@ -138,7 +138,6 @@ class CleanLogs
         $lifetime *= self::SECONDSINDAY;

         $logs = $this->logCollectionFactory->create();
-        $logs->addFieldToFilter('store_id', $store->getId());
         $logs->addFieldToFilter('created_at', ['to' => date("Y-m-d", time() - $lifetime)]);

         return $logs;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.