Article Last Updated: November 9, 2015
On some hosting environments you may receive the following response after you enter your API key and hit save:
We received an unexpected error: null
This error occurs when the server you are on is blocking connection to the Mailchimp API servers. This can occur for many reasons, and occurs more often on shared hosts.
1) Remove the API Key from settings
Before you continue below, you’ll first want to delete the API key you have entered into the settings page. This will ensure the correct response when you go to re-validate your API key.
2) Enable ‘Null Response’ Debugging
If you’re seeing the error message above, you can confirm the cause of the error by entering the following line into the bottom of your functions.php file.
// Enable Null Response Debugging for Easy Forms for Mailchimp define( 'YIKES_MAILCHIMP_NULL_DEBUG', 1 );
3) Re-Validate your API Key
After you enter the above snippet into the bottom of your functions.php file you’ll want to re-enter your API key into the settings page. Once entere hit ‘Save Changes’.
You should now see an error message returned on the screen with the exact cause of the issue. The number one cause is an ‘Access Denied’ response, which states you don’t have permission to access the Mailchimp API server.
You may see something along the lines of:
4) Contact Host Provider
You should be able to open a support ticket with your hosting provider and let them know that the server your site is on is blocking connection with the Mailchimp API. You may want to take a screenshot of the returned error, and include it with your support request so the hosting company can see the issue firsthand.
Once you’ve confirmed the error message and taken a screenshot – you should remove the snippet added in step 2. If you fail to remove the snippet you won’t be able to validate your API key and connect to Mailchimp once the issue is resolved.