dotmailer / dotmailer-magento2-extension

The official Dotdigital for Magento2 extension
https://dotdigital.com/integrations/magento
MIT License
48 stars 63 forks source link

ERROR 1525 (HY000): Incorrect TIMESTAMP value: '' #578

Closed huukhai87 closed 3 years ago

huukhai87 commented 3 years ago

current environment: Magento 2.4.3 Mysql version: 8.0.19-10

issue case: test send abandoned cart by run command

cli:

n98-magerun2 sys:cron:run ddg_automation_abandonedcarts && n98-magerun2 sys:cron:run ddg_automation_campaign

result: error:

SELECT COUNT(*) FROM cron_schedule AS main_table WHERE (job_code = 'ddg_automation_abandonedcarts') AND (scheduled_at = '') AND (status IN('success', 'failed')); ERROR 1525 (HY000): Incorrect TIMESTAMP value: ''

expect: no error

the reason make this issue

file:https://github.com/dotmailer/dotmailer-magento2-extension/blob/master/Model/Cron/JobChecker.php

line:40 ->addFieldToFilter('scheduled_at', $currentRunningJob->getFirstItem()->getScheduledAt())

this code $currentRunningJob->getFirstItem()->getScheduledAt() is always return '' , in scheduled_at = ''

it seems not to validate on Mysql8, everything good with the lower MySQL version

sta1r commented 3 years ago

Hello @huukhai87. If Magento\Cron\Model\Schedule::getScheduledAt() is returning an empty string here that suggests you have a running job with no scheduled_at date. Can you confirm?

Pausing the cron and deleting all running jobs will hopefully resolve this.