fb-instant-articles icon indicating copy to clipboard operation
fb-instant-articles copied to clipboard

Updating failed. Unexpected token < in JSON at position 0

Open tiredwithoutcoffee opened this issue 4 years ago • 3 comments

Steps required to reproduce the problem

  1. Update article post without using classic editor
  2. When updating, a response will show Updating failed. Unexpected token < in JSON at position 0
  3. Although the article has updated
  4. If you update a post in the old classic editor, you do not get this error which suggests its WordPress new editor causing this issue.

Expected Result

Actual Result

IUpdating failed. Unexpected token < in JSON at position 0

Version Info

4.2.1 for the plugin Wordpress 5.6.2 PHP 7.4

Any ideas on how to prevent this popup? As we'd prefer to use the new editor in WordPress and not classic.

tiredwithoutcoffee avatar Mar 17 '21 00:03 tiredwithoutcoffee

It seems this issue has never been fixed with #1009 - Disappointing the developers have not bothered.

tiredwithoutcoffee avatar Mar 17 '21 00:03 tiredwithoutcoffee

Having the same issues. In my case, the cause is a response from Facebook saying the application has not yet been authorized.

The plugin appears to be printing the warning from facebook inside of the JSON response sent after updating the post.

Setting define( 'WP_DEBUG', false ); or error_reporting( null ); is not enough to suppress the warning message.

gthayer avatar Feb 25 '22 21:02 gthayer

I believe the offending lines are here:

https://github.com/Automattic/facebook-instant-articles-wp/blob/master/facebook-instant-articles.php#L522-L523

gthayer avatar Feb 25 '22 21:02 gthayer

That code seems odd - there's no </pre> for instance, and random output from a graph call doesn't seem logical in that context. The code has been removed in https://github.com/Automattic/fb-instant-articles/commit/6275d09a6861169ac23d7d6d4a473c868579925b.

GaryJones avatar Oct 16 '22 02:10 GaryJones