Automattic / newspack-newsletters

Author email newsletters in WordPress
GNU General Public License v2.0
110 stars 22 forks source link

Updating Failed Errors #37

Closed jeffersonrabb closed 4 years ago

jeffersonrabb commented 4 years ago

On occasion I've seen auto-saves of Newsletters fail. The UI shows an Updating failed. notification, and this is the error in the log:

PHP Fatal error:  Uncaught Error: Cannot use object of type WP_Error as array in /srv/www/newspack-repos/newspack-newsletters/includes/class-newspack-newsletters-renderer.php:514
Stack trace:
#0 /srv/www/newspack-repos/newspack-newsletters/includes/class-newspack-newsletters.php(506): Newspack_Newsletters_Renderer::render_html_email(Object(WP_Post))
#1 /srv/www/wordpress-simple/public_html/wp-includes/class-wp-hook.php(287): Newspack_Newsletters::sync_with_mailchimp(5227, Object(WP_Post), true)
#2 /srv/www/wordpress-simple/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
#3 /srv/www/wordpress-simple/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#4 /srv/www/wordpress-simple/public_html/wp-includes/post.php(4133): do_action('save_post_newsp...', 5227, Object(WP_Post), true)
#5 /srv/www/wordpress-simple/public_html/wp-includes/post.php(4235): wp_insert_post(Array, true)
#6 /srv/www/wordpress-simple/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(7 in /srv/www/newspack-repos/newspack-newsletters/includes/class-newspack-newsletters-renderer.php on line 514
jeffersonrabb commented 4 years ago

This is the response from the MJML API:

{
    "errors":
    {
        "http_request_failed": ["cURL error 28: Operation timed out after 5000 milliseconds with 60214 out of 87152 bytes received"]
    },
    "error_data": []
}
jeffersonrabb commented 4 years ago

Probable solution: add a higher timeout parameter to wp_remote_post() in https://github.com/Automattic/newspack-newsletters/blob/master/includes/class-newspack-newsletters-renderer.php#L500-L512. The default is 5s, which may be too low for MJML.

matticbot commented 4 years ago

:tada: This issue has been resolved in version 1.0.0-alpha.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

matticbot commented 4 years ago

:tada: This issue has been resolved in version 1.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: