wp-media / imagify-plugin

Speed up your website with lighter images without losing quality.
https://imagify.io
69 stars 24 forks source link

Fatal error related to Action Scheduler usage. #726

Open piotrbak opened 1 year ago

piotrbak commented 1 year ago

Before submitting an issue please check that you’ve completed the following steps:

Describe the bug While activating/deactivating the plugin on specific website we can see the following error:

[13-Apr-2023 16:17:33 UTC] PHP Fatal error: Uncaught RuntimeException: Error saving action: Error saving action: Database error. in /www/anonym/public/wp-content/plugins/imagify/inc/Dependencies/ActionScheduler/classes/migration/ActionScheduler_DBStoreMigrator.php:44
Stack trace:
#0 /www/anonym/public/wp-content/plugins/imagify/inc/Dependencies/ActionScheduler/classes/data-stores/ActionScheduler_HybridStore.php(242): ActionScheduler_DBStoreMigrator->save_action(Object(ActionScheduler_Action), NULL)
#1 /www/anonym/public/wp-content/plugins/imagify/inc/Dependencies/ActionScheduler/classes/ActionScheduler_ActionFactory.php(244): ActionScheduler_HybridStore->save_action(Object(ActionScheduler_Action))
#2 /www/anonym/public/wp-content/plugins/imagify/inc/Dependencies/ActionScheduler/classes/ActionScheduler_ActionFactory.php(114): ActionScheduler_ActionFactory->store(Object(ActionScheduler_Action))
#3 /www/anonym/public/wp-content/plugins/imagify/inc/Dependencies/ActionScheduler/functions.php(81): ActionScheduler_ActionFactory->single_unique('action_schedule...', Array, 1681402713, 'action-schedule...', false)
#4 /www/anonym/public/wp-content/plugins/imagify/inc/Dependencies/ActionScheduler/classes/migration/Scheduler.php(89): as_schedule_single_action(1681402713, 'action_schedule...', Array, 'action-schedule...')
#5 /www/anonym/public/wp-content/plugins/imagify/inc/Dependencies/ActionScheduler/classes/migration/Controller.php(119): Action_Scheduler\Migration\Scheduler->schedule_migration()
#6 /www/anonym/public/wp-includes/class-wp-hook.php(308): Action_Scheduler\Migration\Controller->schedule_migration('')
#7 /www/anonym/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#8 /www/anonym/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#9 /www/anonym/public/wp-settings.php(645): do_action('wp_loaded')
#10 /www/anonym/public/wp-config.php(100): require_once('/www/anonym...')
#11 /www/anonym/public/wp-load.php(50): require_once('/www/anonym...')
#12 /www/anonym/public/wp-admin/admin.php(34): require_once('/www/anonym...')
#13 /www/anonym/public/wp-admin/plugins.php(10): require_once('/www/anonym...')
#14 {main}
thrown in /www/anonym/public/wp-content/plugins/imagify/inc/Dependencies/ActionScheduler/classes/migration/ActionScheduler_DBStoreMigrator.php on line 44

To Reproduce Steps to reproduce the behavior are still not 100% clear. The issue happens when enabling/disabling plugin.

Expected behavior No fatal errors

Additional context Per @engahmeds3ed

The Action Scheduler migration action is added to actions but the hook is not added, this is the reason for throwing this error:
https://github.com/woocommerce/action-scheduler/pull/806

HS link: https://secure.helpscout.net/conversation/2201678343/411596?folderId=3572901

Backlog Grooming (for WP Media dev team use only)

engahmeds3ed commented 1 year ago

I created a github issue there:

https://github.com/woocommerce/action-scheduler/issues/948