An error occurred during synchronization with MailChimp

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
2 years ago
Since some weeks, we get 3 error logs each time MailChimp scheduled task try to start but we did not change any site config / code or Mailchimp config.


MailChimp error. Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at MailChimp.Net.Core.BaseLogic.Hash(String emailAddressOrHash)
   at Nop.Plugin.Misc.MailChimp.Services.MailChimpManager.GetDeleteSubscriptionsOperations()
   at Nop.Plugin.Misc.MailChimp.Services.MailChimpManager.GetSubscriptionsOperations()
   at Nop.Plugin.Misc.MailChimp.Services.MailChimpManager.<>c__DisplayClass75_0.<<Synchronize>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Nop.Plugin.Misc.MailChimp.Services.MailChimpManager.HandleRequest[T](Func`1 request)

The "Synchronization with MailChimp" scheduled task failed with the "An error occurred during synchronization with MailChimp" error (Task type...
Nop.Core.NopException: An error occurred during synchronization with MailChimp
   at Nop.Plugin.Misc.MailChimp.Services.SynchronizationTask.Execute()
   at Nop.Services.Tasks.Task.ExecuteTask() in D:\PerfBegin\Web\NOP\4.30_Sources\Libraries\Nop.Services\Tasks\Task.cs:line 54
   at Nop.Core.Caching.MemoryCacheManager.PerformActionWithLock(String key, TimeSpan expirationTime, Action action) in D:\PerfBegin\Web\NOP\4.30_Sources\Libraries\Nop.Core\Caching\MemoryCacheManager.cs:line 178
   at Nop.Services.Tasks.Task.Execute(Boolean throwException, Boolean ensureRunOncePerPeriod) in D:\PerfBegin\Web\NOP\4.30_Sources\Libraries\Nop.Services\Tasks\Task.cs:line 130

An error occurred during synchronization with MailChimp
Nop.Core.NopException: An error occurred during synchronization with MailChimp
   at Nop.Plugin.Misc.MailChimp.Services.SynchronizationTask.Execute()
   at Nop.Services.Tasks.Task.ExecuteTask() in D:\PerfBegin\Web\NOP\4.30_Sources\Libraries\Nop.Services\Tasks\Task.cs:line 54
   at Nop.Core.Caching.MemoryCacheManager.PerformActionWithLock(String key, TimeSpan expirationTime, Action action) in D:\PerfBegin\Web\NOP\4.30_Sources\Libraries\Nop.Core\Caching\MemoryCacheManager.cs:line 178
   at Nop.Services.Tasks.Task.Execute(Boolean throwException, Boolean ensureRunOncePerPeriod) in D:\PerfBegin\Web\NOP\4.30_Sources\Libraries\Nop.Services\Tasks\Task.cs:line 130
   at Nop.Web.Areas.Admin.Controllers.ScheduleTaskController.RunNow(Int32 id) in D:\PerfBegin\Web\NOP\4.30_Sources\Presentation\Nop.Web\Areas\Admin\Controllers\ScheduleTaskController.cs:line 115
2 years ago
Thanks for the info, we'll check it.
It seems that somehow a subscription with an empty email has been saved and this leads to errors during sync. Do you have db access to check this?
2 years ago
I checked on both sides, no empty subscription email.
2 years ago
I checked the sync process after updating the plugin to v.2.28 (for platform version v.4.50) and couldn't reproduce the error. Perhaps the reason is incorrect data in your database. If there is information about new details of the error or how to reproduce it, then let us know.
1 year ago
After some trapping, it seems to be in the MailChimpManager.cs unit around 576 where it's calling the Hash method.  There's no check to see if the record.Email is null.   I added the following to help prior to the has call:

                    // Verify not a null email
                    if (record.Email == null)
                        continue;

There's a similar call around line 525 where I did same thing:

                    // Verify not a null email
                    if (subscription.Email == null)
                        continue;

This seemed to resolve the object error.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.