Note: this might be similar to another issue with 7.x here - https://www.drupal.org/node/2751831#comment-11466387 - but I'm getting it with 8.x-dev.
I'm using Mailchimp 8.x-dev, Drupal 8.1.8.
On localhost (homestead setup with php7/nginx) mailchimp lists work great.
However, on a fresh DigitalOcean install (Ubuntu16,PHP7.0,Nginx, SSL) whenever i run a cache rebuild, i loose all the lists in mailchimp - and the signup forms stop working.
I get the following notice when going back to mailchimp and clicking to refresh the lists.
Notice: Trying to get property of non-object in mailchimp_get_lists()
I'm having a hard time finding rhyme or reason for it. When it stops working, it doesn't work immediately after drush cache-rebuild, cron run, etc. Then in an hour or two, or sometimes the next day, it'll just start working.
Comments
Comment #2
ruscoe CreditAttribution: ruscoe at ThinkShout for Mailchimp commentedSounds like the lists aren't being pulled from MailChimp and cached when they should be.
Until we have a fix for this, could you try loading
/admin/config/services/mailchimp/lists
immediately after a cache clear? That should force all your lists to be retrieved again.Comment #3
chuckienorton CreditAttribution: chuckienorton commentedThanks @Ruscoe.
I replied slowly here because
First - I tried your suggestion and cleared the cache specifically from that page in fact. No luck.
Second - i decided i would make sure all the other modules & drupal were updated just in case that had something to do with it. Now i'm on Drupal 8.2.2 and the issue persists. It still works great on local vagrant box, and doesn't work on live site. I even checked mailchimp's api keys page & it actually shows a call to /lists and successful response.
Third -
I also considered (from googling around) this issue where mailchimp isn't happy with my servers ssl. However i run the following from ssh:
echo GET | openssl s_client -CApath /etc/ssl/certs/ -connect us3.api.mailchimp.com:443 2>&1
... I get a successful response.
Fourth -
I considered that this could have something to do with my cache bins. So i switched my settings.php & settings.yaml files to look similar to local server - with
But that still didn't change the fact that mailchimp lists don't refresh.
Definitely has something to do with caching. But I'm at a loss for why or how to fix.
I woke up this morning and they were magically working again. Then i hit ./drush cr and they stopped. :(
Thanks again for help!
Comment #4
chuckienorton CreditAttribution: chuckienorton commentedPS - follow up on full error notice from error logs:
Comment #5
daou CreditAttribution: daou commentedDid you find a solution for this?
Comment #6
abarrio CreditAttribution: abarrio at La Drupalera by Emergya for La Drupalera by Emergya commentedHi! I Had this error in a project. I was looking for a solution for the problem and I found one, I don't know if it is the best solution but it works.
The problem is that api response comes without body from mailchimp when http request have version to 1.1 setted (This is the default version that set GuzzleHttp).
I add an extra param in /mailchimp/lib/mailchimp-api-php/src/Mailchimp.php on request method before client->request call.
Comment #7
katski CreditAttribution: katski commentedthanks @abarrio that worked for me, having exact same issue.
Comment #8
jafacakes2011 CreditAttribution: jafacakes2011 at Torchbox commentedI noticed that the member counts on my lists were not updating, making the change @abarrio suggested fixed it for me.
Can we look at getting a patch for this to be applied?
Comment #9
abarrio CreditAttribution: abarrio at La Drupalera by Emergya for La Drupalera by Emergya commentedHi,
after years of this issue still open I have been checking the code of module and I realized that now the library is using composer to be downloaded so maybe we can include a patch on module composer.json file.
Makes sense?
Comment #10
kescoto-thinkshout CreditAttribution: kescoto-thinkshout at ThinkShout for Mailchimp commentedThis issue came up on an older version of the module and we haven't been able to recreate. Postponing until we confirm this is still an issue. @chuckienorton, can you let us know? And @abarrio, can you provide additional info on where to put the patch code if it has changed since 2017?