• Resolved GamingAge

    (@gamingage)


    Hi, the plugin generally has been working great, much appreciated. Nice and simple, but occasionally will trigger a WP “There has been a critical error on this website. Please check your site admin email inbox for instructions.” error which has been isolated to this plugin seemingly.

    In that scenario the WP post publishes fine, but Twitter share does not, which shows the following on the Edit Post page: Unexpected token '<', "
    There h"… is not valid JSON

    Hitting “Tweet Now” then shares to Twitter w/o issue.

    We are using the latest version (2.0.0). I feel this happens after a WP autosave happens, while authoring a longer article or post. Possibly an auth session/token timeout?

    Thanks!

    • This topic was modified 1 year, 5 months ago by GamingAge.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Dharmesh Patel

    (@dharm1025)

    Hi @gamingage ,

    Thank you for reporting the issue and bringing this to our attention.
    We haven’t experienced a similar issue before. So, It will be great if you could provide the error logs, having access to the error logs will greatly assist us in identifying the root cause of the issue and resolving it promptly.

    Thanks

    Thread Starter GamingAge

    (@gamingage)

    Hi @dharm1025 ,

    Since it’s sporadic, I’ll need to enable the debug logs and try to capture it at the right time so I can share that. [Edit.. debug log included below]

    After the WP error happens, going back to the post and hitting “Tweet again” typically throws that odd error (see below). Clicking “Tweet again” a second time works though. Thank you again!

    PHP Fatal
    Uncaught Abraham\TwitterOAuth\TwitterOAuthException: Could not resolve host: upload.twitter.com; Unknown error
    Stack trace:
    
    0 /wp-content/plugins/autoshare-for-twitter/vendor/abraham/twitteroauth/src/TwitterOAuth.php(604): Abraham\TwitterOAuth\TwitterOAuth->request()
    
    1 /wp-content/plugins/autoshare-for-twitter/vendor/abraham/twitteroauth/src/TwitterOAuth.php(537): Abraham\TwitterOAuth\TwitterOAuth->oAuthRequest()
    
    2 /wp-content/plugins/autoshare-for-twitter/vendor/abraham/twitteroauth/src/TwitterOAuth.php(489): Abraham\TwitterOAuth\TwitterOAuth->makeRequests()
    
    3 /wp-content/plugins/autoshare-for-twitter/vendor/abraham/twitteroauth/src/TwitterOAuth.php(353): Abraham\TwitterOAuth\TwitterOAuth->http()
    
    4 /wp-content/plugins/autoshare-for-twitter/vendor/abraham/twitteroauth/src/TwitterOAuth.php(304): Abraham\TwitterOAuth\TwitterOAuth->uploadMediaNotChunked()
    
    5 /wp-content/plugins/autoshare-for-twitter/includes/class-publish-tweet.php(299): Abraham\TwitterOAuth\TwitterOAuth->upload()
    
    6 /wp-content/plugins/autoshare-for-twitter/includes/class-publish-tweet.php(271): TenUp\AutoshareForTwitter\Core\Publish_Tweet\Publish_Tweet->upload()
    
    7 /wp-content/plugins/autoshare-for-twitter/includes/class-publish-tweet.php(109): TenUp\AutoshareForTwitter\Core\Publish_Tweet\Publish_Tweet->get_upload_data_media_id()
    
    8 /wp-content/plugins/autoshare-for-twitter/includes/admin/post-transition.php(124): TenUp\AutoshareForTwitter\Core\Publish_Tweet\Publish_Tweet->status_update()
    
    9 /wp-content/plugins/autoshare-for-twitter/includes/admin/post-transition.php(85): TenUp\AutoshareForTwitter\Core\Post_Transition\publish_tweet()
    
    10 /wp-includes/class-wp-hook.php(308): TenUp\AutoshareForTwitter\Core\Post_Transition\maybe_publish_tweet()
    
    11 /wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
    
    12 /wp-includes/plugin.php(517): WP_Hook->do_action()
    
    13 /wp-includes/post.php(5345): do_action()
    
    14 /wp-includes/post.php(4605): wp_transition_post_status()
    
    15 /wp-includes/post.php(4817): wp_insert_post()
    
    16 /wp-admin/includes/post.php(439): wp_update_post()
    
    17 /wp-admin/post.php(227): edit_post()
    
    18 {main} thrown in /wp-content/plugins/autoshare-for-twitter/vendor/abraham/twitteroauth/src/TwitterOAuth.php on line 715
    
    Plugin: Autoshare for Twitter
    File: /wp-content/plugins/autoshare-for-twitter/vendor/abraham/twitteroauth/src/TwitterOAuth.php
    Line: 715
    • This reply was modified 1 year, 5 months ago by GamingAge.
    • This reply was modified 1 year, 5 months ago by GamingAge.
    Plugin Contributor Dharmesh Patel

    (@dharm1025)

    Hi @gamingage,

    Thank you for sharing the error logs. The error message “Could not resolve host: upload.twitter.com” usually occurs when a system is unable to find the IP address associated with the hostname “upload.twitter.com”. Based on the provided logs, it appears to be a DNS resolution failure on your server.

    To resolve this issue, I recommend reaching out to your hosting provider for assistance. They can investigate the DNS configuration and help resolve any issues that may be causing the failure.

    However, it would be helpful if the plugin could provide a more informative error message to avoid confusion. I have opened an issue on the plugin’s repository to address this concern, and it will be addressed in a future update.

    Thank you once again for reporting the issue and sharing the error logs.

    Best Regards,

    Thread Starter GamingAge

    (@gamingage)

    Thanks for the feedback! Interestingly it works ~3/4 of the time (plenty of shares as you can see https://twitter.com/GamingAge ), and then just blows up (not very elegantly, showing that WP error page instead of just a notification or alert), so it seems odd that it could be my server hosting, but we’ll ask questions.

    With all changes Twitter itself is undergoing, seemingly making it less reliable, I’d almost think it may be on their end.

    Thread Starter GamingAge

    (@gamingage)

    @dharm1025

    I did catch the other error as well in my logs, this is AFTER the autoshare Tweet fails, when I go back to the post in Edit mode to use the “Tweet Now” function, which returns the “Unexpected token ‘<‘, “There h”… is not valid JSON” error.

    4 PHP Fatal 
    Uncaught Error: Call to undefined method Abraham\TwitterOAuth\TwitterOAuth::setApiVersion()
    Stack trace:
    
    0 /wp-content/plugins/autoshare-for-twitter/includes/class-publish-tweet.php(271): TenUp\AutoshareForTwitter\Core\Publish_Tweet\Publish_Tweet->upload()
    
    1 /wp-content/plugins/autoshare-for-twitter/includes/class-publish-tweet.php(109): TenUp\AutoshareForTwitter\Core\Publish_Tweet\Publish_Tweet->get_upload_data_media_id()
    
    2 /wp-content/plugins/autoshare-for-twitter/includes/admin/post-transition.php(124): TenUp\AutoshareForTwitter\Core\Publish_Tweet\Publish_Tweet->status_update()
    
    3 /wp-content/plugins/autoshare-for-twitter/includes/admin/post-transition.php(163): TenUp\AutoshareForTwitter\Core\Post_Transition\publish_tweet()
    
    4 /wp-includes/class-wp-hook.php(308): TenUp\AutoshareForTwitter\Core\Post_Transition\retweet()
    
    5 /wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
    
    6 /wp-includes/plugin.php(517): WP_Hook->do_action()
    
    7 /wp-admin/admin-ajax.php(188): do_action()
    
    8 {main} thrown in /wp-content/plugins/autoshare-for-twitter/includes/class-publish-tweet.php on line 298
    
    Plugin: Autoshare for Twitter
    File: /wp-content/plugins/autoshare-for-twitter/includes/class-publish-tweet.php
    Line: 298
    Plugin Contributor Dharmesh Patel

    (@dharm1025)

    Updates:
    Error handling has been improved in the recent release 2.1.0 to provide more informative error messages. The plugin now offers clear error messages in case of failure.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Random WP error and unexpected token response when sharing’ is closed to new replies.