WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 6 hours ago

#45373 new defect (bug)

New reusable block creation returning blank white screen

Reported by: umakantsharmamwb Owned by:
Milestone: 5.1 Priority: normal
Severity: normal Version: 5.0
Component: Editor Keywords: has-patch
Focuses: rest-api Cc:

Description

When trying to create a new reusable block, at the time of creating a new post, in wordpress5.0-beta5, the screen goes blank with js error -

Unhandled promise rejection Error: "[object Object]" wp-pollyfill.min.js-2:29718

Attachments (1)

45373-edit-posts.patch (601 bytes) - added by aduth 10 hours ago.

Download all attachments as: .zip

Change History (14)

#1 @matveb
6 weeks ago

  • Milestone changed from Awaiting Review to 5.0.1

#2 @SergeyBiryukov
6 weeks ago

  • Component changed from General to Editor

#3 @pento
5 weeks ago

  • Milestone changed from 5.0.1 to 5.0.2

#4 @pento
5 weeks ago

  • Milestone changed from 5.0.2 to 5.0.3

#5 @audrasjb
3 weeks ago

  • Keywords needs-patch added
  • Milestone changed from 5.0.3 to 5.1

Hello, welcome to WordPress Trac and thank you for this ticket,

5.0.3 is going to be released in a couple of weeks. We are currently sorting the remaining tickets in the milestone. It doesn't appear that ticket can be handled in the next couple of weeks (still needs a patch). Let's address it in 5.1 which is coming in February. Feel free to change/ask to change the milestone if you think the issue can be quickly resolved.

#6 follow-up: @desrosj
3 days ago

  • Keywords reporter-feedback added

@umakantsharmamwb I have not been able to reproduce the issue you have described. Can you please see if you are still able to produce the bug?

If you are, can you please give some more detailed instructions so others can reproduce exactly what you are seeing?

#7 in reply to: ↑ 6 ; follow-up: @umakantsharmamwb
3 days ago

Replying to desrosj:

@umakantsharmamwb I have not been able to reproduce the issue you have described. Can you please see if you are still able to produce the bug?

If you are, can you please give some more detailed instructions so others can reproduce exactly what you are seeing?

@desrosj I have attached a gif with the steps, and tested it on fresh new wordpress - 5.3, with no other plugins!

https://ibb.co/KVSMwLy

https://ibb.co/KVSMwLy Thanks!

#8 in reply to: ↑ 7 @juankvillegas
2 days ago

I have exactly this same issue in a clean WordPress 5.0.3 installation with SSL and only 1 plugin enabled: Really Simple SSL

https://ibb.co/KVSMwLy

Last edited 2 days ago by juankvillegas (previous) (diff)

#9 @desrosj
2 days ago

  • Focuses rest-api added
  • Keywords reporter-feedback removed

Thanks for the details, @umakantsharmamwb. I am able to reproduce what you are detailing!

So I did some digging on this. Looks like there is already an issue opened on the Gutenberg GitHub for this, but I am going to leave both open because I think there needs to be an update in both locations.

The REST API request to the blocks endpoint is returning a 403 error. I believe that this is causing the error in wp-polyfill that you are seeing. This should be fixed upstream. A REST API error should not cause a white screen for the user. At a minimum, an error message should be displayed with a path forward.

@designsimply also discovered a strange aspect of this. If the Gutenberg plugin is activated, the Add New Block page work and it continues to work even after the plugin is deactivated. This happens because the plugin block adds capabilities to the user roles, which are stored in the database. These are not cleaned up after the plugin is deactivated/removed, so they remain and the functionality continues to work.

This second issue brings up a bug that could probably be fixed in both locations (Core and the Gutenberg Plugin) so that there is consistency moving forward. The bug in core causing the 403 permissions issue should be fixed, and then, potentially, the plugin should have its capabilities updated to match what is currently in core.

A related issue is #45423, which could potentially fix this problem.

This ticket was mentioned in Slack in #core-restapi by desrosj. View the logs.


35 hours ago

This ticket was mentioned in Slack in #core-editor by aduth. View the logs.


16 hours ago

#12 @aduth
10 hours ago

  • Keywords has-patch added; needs-patch removed

The above patch adds a missing capabilities mapping from the registered wp_block post type from edit_blocks to edit_posts, since a role will never have the edit_blocks capability in a default installation.

As noted by @desrosj / @designsimply , this cannot be reproduced if you had ever had the Gutenberg plugin activated on a site. To work around this, you must deactivate the Gutenberg plugin and reset user roles to their default values. I used the following plugin to achieve this:

https://wordpress.org/plugins/reset-roles-and-capabilities/

I detailed some more specific debugging information at the corresponding GitHub issue, relevant to the rationale for this change, and considerations for additional revisions.

https://github.com/WordPress/gutenberg/issues/12324#issuecomment-455631774

The above patch is intended to serve as a most minimal fix to the issue.

#13 @pento
6 hours ago

Ugh, this was ugly when I worked on it originally.

I vaguely recall there being a problem doing this with edit_posts, I'll need to dig into a bit.

The alternative was to add the edit_blocks caps the same way that the plugin does (#45423), but I haven't had the time to thoroughly investigate that, either.

Note: See TracTickets for help on using tickets.