mailchimp/mc-magento2

Unknown column 'mailchimp_sync_error' in 'NEW' error (something with triggers) - after update from 103.4.53 to 103.4.55

Closed this issue · 11 comments

hostep commented

Issue Description

Preconditions

  1. Magento OS 2.4.6-p2
  2. Having Mailchimp module 103.4.53 installed

Steps to reproduce

Update to version 103.4.55 of Mailchimp module
Run bin/magento setup:upgrade --keep-generated

Actual and Expected result

We get this error on the first execution of setup:upgrade:

$ php bin/magento setup:upgrade --keep-generated
...
Module 'Magento_EavGraphQl':
Module 'Magento_CatalogImportExport':
Module 'Magento_Indexer':
Running schema recurring...SQLSTATE[42S22]: Column not found: 1054 Unknown column 'mailchimp_sync_error' in 'NEW', query was: CREATE TRIGGER trg_catalog_product_entity_after_update AFTER UPDATE ON catalog_product_entity FOR EACH ROW
BEGIN
IF (NOT(NEW.`entity_id` <=> OLD.`entity_id`) OR NOT(NEW.`attribute_set_id` <=> OLD.`attribute_set_id`) OR NOT(NEW.`type_id` <=> OLD.`type_id`) OR NOT(NEW.`sku` <=> OLD.`sku`) OR NOT(NEW.`has_options` <=> OLD.`has_options`) OR NOT(NEW.`required_options` <=> OLD.`required_options`) OR NOT(NEW.`created_at` <=> OLD.`created_at`) OR NOT(NEW.`updated_datetime` <=> OLD.`updated_datetime`) OR NOT(NEW.`mailchimp_sync_error` <=> OLD.`mailchimp_sync_error`) OR NOT(NEW.`mailchimp_sent` <=> OLD.`mailchimp_sent`)) THEN INSERT IGNORE INTO `catalogrule_product_cl` (`entity_id`) VALUES (NEW.`entity_id`); END IF;
IF (NOT(NEW.`entity_id` <=> OLD.`entity_id`) OR NOT(NEW.`attribute_set_id` <=> OLD.`attribute_set_id`) OR NOT(NEW.`type_id` <=> OLD.`type_id`) OR NOT(NEW.`sku` <=> OLD.`sku`) OR NOT(NEW.`has_options` <=> OLD.`has_options`) OR NOT(NEW.`required_options` <=> OLD.`required_options`) OR NOT(NEW.`created_at` <=> OLD.`created_at`) OR NOT(NEW.`updated_datetime` <=> OLD.`updated_datetime`) OR NOT(NEW.`mailchimp_sync_error` <=> OLD.`mailchimp_sync_error`) OR NOT(NEW.`mailchimp_sent` <=> OLD.`mailchimp_sent`)) THEN INSERT IGNORE INTO `catalogsearch_fulltext_cl` (`entity_id`) VALUES (NEW.`entity_id`); END IF;
END

Running setup:upgrade a second time, fixes the problem.

Indexers were all set to "update by schedule".

I didn't have this problem on my local machine, but we encountered it when rolling out this update to the staging environment.

Additional information

Not sure if this is a bug in Mailchimp, or a bug in Magento, where similar sounding bugs got posted:

hostep commented

Already ran into this problem on 2 different projects while deploying this same update to the staging environment. Both times I was not able to reproduce this on my local machine. So some environmental factor plays a role into this? Maybe running the shop in production mode? Maybe something else? Hard to say at this point ...

Hi @hostep

we try with both community and enterprise version of magento, with php 8.1 and 8.2, in production and developer mode, and always works OK.
Looks more a magento issue when you upgrade the magento from a previous version, all the referred issues have in common that they upgrade the magento from a previous version.
Let me know if this is your case

Best

hostep commented

Thanks for quick feedback @gonzaloebiz, we weren't upgrading Magento at the same time, we only updated the Mailchimp module itself. That's it.

No idea how to reproduce, it seems to be something pretty complicated, won't have time for more digging today I'm afraid, maybe later, but can't promise ...

Hello,

Same issue with 103.4.56. I force 103.4.53 with compose and works back. I will keep this version so far.
To reproduce, I think if you came from a old version and ask composer to have the last version (^103.4.53), it will through the error. I tested locally with 103.4.53 but we I deploy on testing, the version that composer got was 103.4.56 and add the issue.

Same issue faced here with a staging deploy - wasn't replicated when running the process locally.

Possibly related to this change 103.4.53...103.4.55#diff-553830de6c492c073f8c457591c88c38b5c77313a279eaad73fabbe024544047 and environmental factors?

We had this issue too when upgrading Mailchimp module to last version 103.4.56, it happens the first time setup:upgrade runs, on other runs it's ok.

Need more information about, as already say, we test a lot of installations and all works OK.
We try with magento 2.4.6-p2 (always a vanilla installation with sample data), both versions community and enterprise, with PHP 8.1 and 8.2, installing first version 103.4.53 and then 105.4.55 (and 56) and always works OK.
Looking at the links in the first comment, looks like a magento issue when you update magento itself or any other environment but not an issue in the extension.
Perhaps anyone here can be more specific about your magento update and can specify step by step how to replicate the issue

Best

hostep commented

Ran into this again today while updating from 103.4.53 to 103.4.57 on another project.
Still no idea how to reproduce it, but the issue is very real. A second deploy fixed it again, so it's not a big deal, just annoying to run into ...

In case it helps: indexers need to be in mode 'scheduled' and not 'realtime', otherwise those triggers don't exist. Maybe that can help in trying to find steps to reproduce?

Same here - if it's of any help, I'm facing these issues when deploying to the Cloud environments. Local process is fine.

Same issue here. We were upgrading Magento from 2.4.5-p4 to 2.4.5-p5 and Mailchimp from 103.4.53 -> 103.4.57. Repeated runs resolved the issue (it took two goes of re-running setup:upgrade).

Same here, I think it does not have to with the the update of magento, it happens upon updating the plugin mailchimp to the version 103.4.57 and throw the setup:upgare in production mode.
FYI: throwing the setup:upgare for the second time solve the error.