WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.46k stars 4.18k forks source link

Blank screen on new post or page, but not when editing existing content #9295

Closed PDowney closed 6 years ago

PDowney commented 6 years ago

Describe the bug When attempting to create a new post or page, the dreaded blank screen appears. Strangely, Gutenberg editor loads fine when attempting to edit content that was already created with the classic editor prior to installing Gutenberg.

To Reproduce 1: Add New Post or Page

Server

WordPress Theme

Plugins Enabled

Browsers Tested

Steps already taken I've changed my try_files within Nginx vhost file to: try_files $uri $uri/ /index.php$is_args$args;

I've turned off any Nginx rules that could possibly be blocking wp-json or such.

I've added a skip_cache rule to my nginx vhost to disable caching for /wp-json.*

This test server is not running any type of firewall, which eliminates any local filtering that's happening on my end.

I've added a page rule within cloudflare to whitelist mysite.com/wp-json Within this rule, I've turned off security, performance, caching, browser integrity, and apps

Curl Results on /wp-json Loading mysite.com/wp-json loads that huge page of text as normal.

$ curl https://mysite.com/wp-json -I

HTTP/1.1 200 OK Date: Fri, 24 Aug 2018 05:17:36 GMT Content-Type: application/json; charset=UTF-8 Connection: keep-alive Set-Cookie: __cfduid=df4af168f4784360a34b22bf022ff719e1535087856; expires=Sat, 24-Aug-19 05:17:36 GMT; path=/; domain=.mysite.com; HttpOnly Vary: Accept-Encoding X-Robots-Tag: noindex Link: https://mysite.com/wp-json/; rel="https://api.w.org/" X-Content-Type-Options: nosniff Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages Access-Control-Allow-Headers: Authorization, Content-Type Allow: GET X-Powered-By: mysite.com X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Referrer-Policy: unsafe-url Content-Security-Policy: default-src https: data: 'unsafe-inline' 'unsafe-eval' always X-UA-Compatible: IE=Edge X-FastCGI-Cached: BYPASS Strict-Transport-Security: max-age=15552000; includeSubDomains; preload Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Server: cloudflare CF-RAY: 44f35a80efedb9ac-ATL

Chrome console log when creating new post No errors shown whatsoever

Chrome console log when editing existing post The only error displayed is:

Warning: Unsafe lifecycle methods were found within a strict-mode tree: in Unknown (created by e) in e (created by RemountOnPropChange(e)) in RemountOnPropChange(e) in WithSelect(Component)

componentWillUpdate: Please update the following components to use componentDidUpdate instead: t

WordPress Debug Log [24-Aug-2018 05:30:29 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/mysite.com/html/wp-includes/post.php on line 6136 [24-Aug-2018 05:30:29 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/mysite.com/html/wp-includes/post.php on line 6137 [24-Aug-2018 05:30:29 UTC] PHP Notice: Trying to get property 'ID' of non-object in /var/www/mysite.com/html/wp-includes/post.php on line 6141 [24-Aug-2018 05:30:29 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/mysite.com/html/wp-includes/post.php on line 6360 [24-Aug-2018 05:30:29 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/mysite.com/html/wp-includes/theme.php on line 2863 [24-Aug-2018 05:30:29 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/mysite.com/html/wp-includes/theme.php on line 3087 [24-Aug-2018 05:30:29 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/mysite.com/html/wp-includes/post.php on line 4161 [24-Aug-2018 05:30:29 UTC] PHP Notice: Trying to get property 'ID' of non-object in /var/www/mysite.com/html/wp-includes/post.php on line 4161 [24-Aug-2018 05:30:29 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/mysite.com/html/wp-includes/post.php on line 3662 [24-Aug-2018 05:30:29 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/mysite.com/html/wp-admin/includes/post.php on line 610 [24-Aug-2018 05:30:29 UTC] PHP Warning: Creating default object from empty value in /var/www/mysite.com/html/wp-admin/includes/post.php on line 642 [24-Aug-2018 05:30:29 UTC] PHP Notice: Undefined property: stdClass::$ID in /var/www/mysite.com/html/wp-admin/post-new.php on line 71 [24-Aug-2018 05:30:29 UTC] PHP Notice: Undefined property: stdClass::$post_status in /var/www/mysite.com/html/wp-content/plugins/gutenberg/lib/client-assets.php on line 1166 [24-Aug-2018 05:30:29 UTC] PHP Notice: Undefined property: stdClass::$post_type in /var/www/mysite.com/html/wp-content/plugins/gutenberg/lib/client-assets.php on line 1350 [24-Aug-2018 05:30:29 UTC] PHP Notice: Undefined property: stdClass::$post_type in /var/www/mysite.com/html/wp-content/plugins/gutenberg/lib/register.php on line 58 [24-Aug-2018 05:30:29 UTC] PHP Warning: Invalid argument supplied for foreach() in /var/www/mysite.com/html/wp-content/plugins/gutenberg/lib/meta-box-partial-page.php on line 128 [24-Aug-2018 05:30:29 UTC] PHP Notice: Undefined property: stdClass::$post_status in /var/www/mysite.com/html/wp-content/plugins/gutenberg/lib/meta-box-partial-page.php on line 354 [24-Aug-2018 05:30:29 UTC] PHP Notice: Undefined property: stdClass::$post_type in /var/www/mysite.com/html/wp-content/plugins/gutenberg/lib/meta-box-partial-page.php on line 368 [24-Aug-2018 05:30:29 UTC] PHP Notice: Undefined property: stdClass::$post_status in /var/www/mysite.com/html/wp-content/plugins/gutenberg/lib/meta-box-partial-page.php on line 369

Domain's Nginx Logs No Issues

Cloudflare Firewall Log This is a free account, so I do not have access to the pro account's WAF settings. However, WAF caught Gutenberg and blocked it on August 18th, the day of initial Gutenberg installation. I've whitelisted the IP address, but as a free account I have no way of whitelisting the specific WAF rule in question.

Ray ID 44c2e260c06a5f4b Time August 18, 2018 04:06:59 (-04:00) Data Center Las Vegas, United States (LAS)

Rule ID WP0025D

PDowney commented 6 years ago

Just a quick update that this is still an active issue after the latest official Gutenberg release (3.7.0).

The Cloudflare WAF log has disappeared at this point, as well. but blank screen continues to show. No additional Cloudflare WAF rules have been triggered since August 18.

designsimply commented 6 years ago

@PDowney does this problem persist after updating to 3.8.0 (released on 12-Sep)?

To confirm, there are no errors at all in the browser console when you go to Posts > Add New?

pento commented 6 years ago

Thank you for the bug report, @PDowney!

The WordPress debug log suggests that this isn't a Cloudflare issue, as Cloudflare will block the connection from reaching your server, so WordPress is never run in that instance.

I suspect this might be a DB or caching-related issue: all of these warnings are occurring because WordPress was unable to retrieve a post immediately after writing it to the database.

In wp_insert_post(), (wp-includes/post.php) it goes a little something like this:

So, to help us dig a little further, I have a few more questions:

PDowney commented 6 years ago

This problem is resolved. As per Pento's reply, I'm leaning towards the issue being related to some database issue. I reinstalled a fresh installation and the problem went away.

chrisnasulea commented 5 years ago

I still have this issue now with a WP 4.9.8 and Gutenberg installed. I can't do a fresh installation because we're talking about a university website with tons of information in it.

chrisnasulea commented 5 years ago

It's the 3 filters in wp-admin/includes/post.php that are causing the problem. Here are the troublesome lines of code:

$post->post_content = apply_filters( 'default_content', $post_content, $post );

$post->post_title = apply_filters( 'default_title', $post_title, $post );

$post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post );