Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in ebizmarts_ecommerce after upgrading to 1.0.26 #186

Closed
andrewkett opened this issue Jan 25, 2018 · 13 comments · Fixed by #191
Closed

Error in ebizmarts_ecommerce after upgrading to 1.0.26 #186

andrewkett opened this issue Jan 25, 2018 · 13 comments · Fixed by #191
Assignees
Labels
Milestone

Comments

@andrewkett
Copy link

andrewkett commented Jan 25, 2018

Issue Description

Running ebizmarts_ecommerce after upgrading to 1.0.26 results in a fatal php error if DI has been compiled using setup:di:compile

PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Eav\Model\Entity\Attribute\Source\Config::__construct() must be of the type array, null given, called in /var/www/src/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 111 and defined in /var/www/src/vendor/magento/module-eav/Model/Entity/Attribute/Source/Config.php:26

Preconditions

  • Magento 2.2.1
  • PHP 7.1.10

Steps to reproduce

  • install mc-magento 1.0.26 (mine was upgraded from 1.0.25 with composer, I haven't tested this on a clean install).
  • run setup:di:compile
  • run ebizmarts_ecommerce cron task (I ran with magerun but same thing happens when running php bin/magento cron:run if the job is scheduled)

Expected Result

ebizmarts_ecommerce task runs successfully

Actual Result

ebizmarts_ecommerce dies with fatal php error highlighted above

@gonzaloebiz gonzaloebiz self-assigned this Jan 26, 2018
@gonzaloebiz
Copy link
Collaborator

Hi @andrewkett

thanks for your feedback.
What version of magento do you have?
I try with a clean installation of magento 2.1.10 with sample data and works OK for me.
I will try install first mc-magento2 1.0.25 and update it to 1.0.26

Best

@dborishansky
Copy link

dborishansky commented Jan 26, 2018

@gonzaloebiz, I can confirm the same behavior reported by @andrewkett on 2.1.10. Seeing this on Magento Cloud in the cron log:

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Magento\Eav\Model\Entity\Attribute\Source\Config::__construct() must be of the type array, null given, called in /app/######/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93 and defined in /app/######/vendor/magento/module-eav/Model/Entity/Attribute/Source/Config.php:26
Stack trace:
#0 /app/######/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(93): Magento\Eav\Model\Entity\Attribute\Source\Config->__construct(NULL)
#1 /app/######/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Eav\\Mod...', Array)
#2 /app/######/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Eav\\Mod...', Array)
#3 /app/######/vendor/magento/framework/Validator/UniversalFactory.php(36): Magento\Framework\ObjectMan in /app/######/vendor/magento/module-eav/Model/Entity/Attribute/Source/Config.php on line 26

I hope that helps a little. Thanks for looking at this.

@gonzaloebiz
Copy link
Collaborator

Hi @andrewkett @dborishansky

i just try with a clean magento 2.1.10 installation with sample data.
First install mc-magento2 1.0.25, run setup:upgrade and then setup:di:conpile, configure the extension and sync some products in the first run of the ebizmarts_ecommerce process.
Then update the mc-magento2 extension to 1.0.26, run setup:upgrade and setup:di:compile, then wait that the process runs, and runs OK (syncs other set of products).
So i need more information to replicate the issue.
@dborishansky why you think this error is related to our extension? I don't see any reference to us and if you search in the entire extension, there are 2 references.
On this

use Magento\Eav\Setup\EavSetupFactory;
and on this
$isDate = ($item->getBackendModel()=='Magento\Eav\Model\Entity\Attribute\Backend\Datetime') ? 1:0;
, no one is executed in the cronjob.

Waiting for more information.

Best

@andrewkett
Copy link
Author

Sorry @gonzaloebiz somehow I left this info off my origin comment. I have updated it with preconditions.

@gonzaloebiz
Copy link
Collaborator

@andrewkett

i will check with magento 2.2.1 and back to you

Best

@andrewkett
Copy link
Author

@gonzalobiz, I agree it's not immediately obvious that this is related to the extension but that does seem to be the case to me at the moment. After going back to 1.0.25 I don't get the issue anymore. As you said the stack trace doesn't reference the extension so it's hard to pinpoint the exact cause. When I a chance (probably won't be for a few days) I will try with PHP 7.0 and 5.6 to rule the php version out as the problem.

@dborishansky
Copy link

Clearing out the mailchimp_ecommerce_sync table may be the secret to reproducing this issue.

Here's the trace I was able to surface by logging the exception in this catch: https://github.com/mailchimp/mc-magento2/blob/1.0.26/Cron/Ecommerce.php#L206, and running the ebizmarts_ecommerce job with n98-magerun2:

Invalid Resource : The resource submitted could not be validated. For field-specific details, see the 'errors' array.MailChimp error
235
#0 /vagrant/magento/vendor/ebizmarts/mailchimp-lib/src/Mailchimp/BatchOperations.php(24): Mailchimp->call('batches', '{"operations":[...', 'POST')
#1 /vagrant/magento/vendor/mailchimp/mc-magento2/Cron/Ecommerce.php(210): Mailchimp_BatchOperations->add(Array)
#2 /vagrant/magento/vendor/mailchimp/mc-magento2/Cron/Ecommerce.php(127): Ebizmarts\MailChimp\Cron\Ecommerce->_processStore(1, '###############...', '##########')
#3 [internal function]: Ebizmarts\MailChimp\Cron\Ecommerce->execute(Object(Magento\Cron\Model\Schedule))
#4 /vagrant/magento/vendor/magento/framework/App/State.php(171): call_user_func_array(Array, Array)
#5 /vagrant/magento/vendor/n98/magerun2/src/N98/Magento/Command/System/Cron/RunCommand.php(58): Magento\Framework\App\State->emulateAreaCode('crontab', Array, Array)
#6 /vagrant/magento/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): N98\Magento\Command\System\Cron\RunCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /vagrant/magento/vendor/n98/magerun2/src/N98/Magento/Command/AbstractMagentoCommand.php(359): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /vagrant/magento/vendor/symfony/console/Symfony/Component/Console/Application.php(882): N98\Magento\Command\AbstractMagentoCommand->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /vagrant/magento/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(N98\Magento\Command\System\Cron\RunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /vagrant/magento/vendor/n98/magerun2/src/N98/Magento/Application.php(538): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /vagrant/magento/vendor/symfony/console/Symfony/Component/Console/Application.php(126): N98\Magento\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /vagrant/magento/vendor/n98/magerun2/src/N98/Magento/Application.php(576): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /vagrant/magento/vendor/n98/magerun2/bin/n98-magerun2(5): N98\Magento\Application->run()
#14 {main}

The field causing the issue in my case was operations.item.182 which was a null orders object. This caused an issue with the POST via curl, which expects a JSON object, so the batch failed to sync.

On a more positive note, the ebizmarts_ecommerce cron succeeded after commenting out the orders sync (https://github.com/mailchimp/mc-magento2/blob/1.0.26/Cron/Ecommerce.php#L172-L174).

Notably, uncommenting the orders sync after that did not cause the error to return, and I could see some order records had been inserted in mailchimp_sync_ecommerce. Clearing out mailchimp_sync_ecommerce brought the error right back.

Based on this, it seems that:

Does this check out for you, @gonzaloebiz and @andrewkett?

@gonzaloebiz
Copy link
Collaborator

Hi @dborishansky

this issue is looks like not the same as the original, please open a new one

Best

@gonzaloebiz
Copy link
Collaborator

@andrewkett @dborishansky

apply the associate commit.

Best

@andrewkett
Copy link
Author

@gonzaloebiz what are your timeframes for the 1.0.27 release? Currently 1.0.26 isn't usable for us so would be great to have the next release with this fix in it.

@gonzaloebiz
Copy link
Collaborator

Hi @andrewkett

can you confirm if the commit fix your issue?

Best

@alloylab
Copy link

this issue is the same I was having, #190

No error message are logged if ebizmarts_ecommerce cron job is already stuck at a status of running. Once I cleared the running job .... I was able to reproduce the following php error

[30-Jan-2018 18:58:29 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Eav\Model\Entity\Attribute\Source\Config::__construct() must be of the type array, null given, called in /XXX/src/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 111 and defined in /XXX/src/vendor/magento/module-eav/Model/Entity/Attribute/Source/Config.php:26 Stack trace: #0 /XXX/src/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Eav\Model\Entity\Attribute\Source\Config->__construct(NULL) #1 /XXX/src/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Eav\\Mod...', Array) #2 /XXX/src/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Eav\\Mod...', Array) #3 /XXX/src/vendor/magento/framework/Valida in /XXX/src/vendor/magento/module-eav/Model/Entity/Attribute/Source/Config.php on line 26

I can confirm that this commit fixed the php error and is now allowing us to sync

@andrewkett
Copy link
Author

The #191 commit does seem to resolve the issue thanks @gonzaloebiz 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants