Gutenberg: Unhandled promise rejection Error: "[object Object]"

Created on 18 Dec 2018  路  10Comments  路  Source: WordPress/gutenberg

I am not able to create a post. I am using twentynineteen theme without any plugin. "Unhandled promise rejection Error: "[object Object]"" error is occurring in console. I am using WordPress image "wordpress:5.0.0-apache" from docker hub.

Screenshot: https://prnt.sc/lwjqfh

12982

  • OS: Ubantu
  • Browser: Firefox
  • Version: 61.0.1
[Status] Needs More Info [Type] Help Request

Most helpful comment

FWIW for future people having this problem, the REST API won't work if you turn on pretty permalinks but don't update your .htaccess.

For Gutenberg's part, would it be any trouble to print a more descriptive error in the console (e.g. "REST API not accessible")?

All 10 comments

Thank you for posting screenshots of the console errors!

I noticed the same errors are reported at https://github.com/WordPress/gutenberg/issues/12208 and I would like to close the issue here and continue the discussion in https://github.com/WordPress/gutenberg/issues/12208 with a note that if we find the case to be different we can re-open this issue.

Re-opening because the person who opened #12208 said the issue resolved for them automatically.

If you are still having trouble, please update to the latest stable release of WordPress and please check to make sure your site's API is working properly. You can do that by adding wp-json to the end of your site URL鈥攊f you get back an error, you will need to investigate why the API is not working for your site. Otherwise, you should just see a whole lot of text.

If you find you are still having trouble, please ask to re-open this issue (or create a new one) with any relevant details you may have found in addition to your earlier report.

FWIW for future people having this problem, the REST API won't work if you turn on pretty permalinks but don't update your .htaccess.

For Gutenberg's part, would it be any trouble to print a more descriptive error in the console (e.g. "REST API not accessible")?

The messaging will be improved here very slightly as of #13315 (slated for Gutenberg 5.0), but only in logging the actual error object rather than "[object Response]".

On Gutenberg's part, these errors should ideally never occur, either being accounted for on a case-by-case basis with some graceful fallback (or UI messaging, not console messaging). Alternatively, I could imagine it as part of some generalized WordPress "site checkup" feature to detect possible misconfigurations like the one you describe.

I keep getting the same error. It doesn't seem that my .htaccess is a problem, it gets updated... More details here.
My firefox console shows the same sight as shown by @usmaniqbalse

@jaumemirallesisern I'm not sure yet what might be going wrong in your case but as a first check and since you didn't mention it the linked support forum post, did you test to make sure your site's API is working as expected?

@designsimply thanks for your response.
Yes, I realized of this thread in Github after posting in forum.
If I type in browser bar: theurltomysite/wp-json
I get a 404 Not found error
(just in case... my url has a subdomain)

@jaumemirallesisern There are different reasons for the Rest API to not work properly.

  • It can be a server configuration issue see here for instance (see #1761 for instance)
  • It can be a plugin disabling the REST API
  • It can a plugin conflict resulting in bad responses.

Unfortunately, we can't do anything about it in the Gutenberg repo. you should try to debug and find the culprit for your particular use-cases. One first step could be to check the response content of the network request triggering the issue. (in your browser console's network tab)

I will share my experience on here. My problem with my theme's functions.php there is a shortcode function which is using ob_start() and ob_get_clean() functions. When I activate another theme, or empty the functions.php, problem is gone. For solution, I wrapped in if( is_admin() ): the shortcode definition ( add_shortcode part ) and the shortcode function.

Maybe this help you too. Try empty your theme's functions.php (of course backup first, heheh) if problem is gone when your functions.php, is empty, look the ob_start() and ob_get_clean() functions and disable for admin panel. Hope this helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

youknowriad picture youknowriad  路  3Comments

jasmussen picture jasmussen  路  3Comments

moorscode picture moorscode  路  3Comments

nylen picture nylen  路  3Comments

aduth picture aduth  路  3Comments