adventistchurch / alps-gutenberg-blocks

A Wordpress plugin to create Gutenberg plugins that work for ALPS.
4 stars 6 forks source link

"register_rest_route" error #72

Closed dburry closed 2 years ago

dburry commented 3 years ago

On my test machine, when I go to a page and edit it... momentarily I see the following error message:

Screen Shot 2021-06-17 at 15 33 35

and then after 1 second I see the normal edit screen.

Also, when I go to change the parent here I see the same error in a response header field (numbered arrows are steps to reproduce it):

Screen Shot 2021-06-17 at 15 47 59

Note that both calls listed that go to "/index.php?rest_route=/wp/v2/pages*" have this error.

Now on the https://www.adventist.org site, the call to /wp-json/wp/v2/pages* actually becomes a 500 error additionally:

Screen Shot 2021-06-17 at 16 03 15

(it also has this error message present in a response header, though it's not shown in this screenshot)

I have looked at the php debug and wp debug settings and so far have been unable to get any further error message from the 500 error...

designerbrent commented 3 years ago

Here is the error that Wordpress returns:

`x-wp-doingitwrong register_rest_route (since 5.5.0; The REST API route definition for <code>alps-gutenberg-blocks/latest-posts/tags</code> is missing the required <code>permission_callback</code> argument. For REST API routes that are intended to be public, use <code>__return_true</code> as the permission callback.)

`

YauheniKapliarchuk commented 3 years ago

https://www.adventist.org/wp-json/wp/v2/pages?per_page=100&exclude=32029&parent_exclude=32029&orderby=menu_order&order=asc&co ntext=edit&_locale=user

dburry commented 3 years ago

the full url on adventist.org for this specific error is:

https://www.adventist.org/wp-json/wp/v2/pages?per_page=100&exclude=32029&parent_exclude=32029&orderby=menu_order&order=asc&context=edit&_locale=user

dburry commented 3 years ago

here is where I found the call to register_rest_route within the alps-gutenberg-blocks code:

adventist@web05:/www/www.adventist.org/public_html/wp-content/plugins/alps-gutenberg-blocks$ grep -rn register_rest_route .
./src/blocks/latest-posts/block.php:90:        register_rest_route( 'alps-gutenberg-blocks', '/latest-posts/tags', [
dburry commented 3 years ago

here I found an explanation for this error:

https://make.wordpress.org/core/2020/07/22/rest-api-changes-in-wordpress-5-5/ search for the word "doing" and you will see the explanation.

designerbrent commented 3 years ago

A quick update: Late last week we found the blame for the error preventing the changing of the page was a different plugin. That said, I would still like to make sure that this warning gets resolved so we are more prepared moving forward.

YauheniKapliarchuk commented 2 years ago

After some investigation we decided:

After that test to continue or finish.

Thanks, Best Regards!

CC: @hans-olson @daniel-eesti @johnrbeckett @designerbrent

YauheniKapliarchuk commented 2 years ago

Hello everyone.

At the moment, I have checked this case on my local investment. I also checked the production staging. The main reason was not updated plugins, I made the necessary updates and this problem was fixed. Please let us know if it appears again and how to reproduce it.

Screenshot 2022-10-10 at 19.39.16.png

@designerbrent also I checked the request from ALPS Guthenberg Blocks and now it works correct on my local env and prod staging.

@daniel-eesti @hans-olson Could you please check it on your side?

Thanks, Best Regards!

CC: @designerbrent @dburry @johnrbeckett

daniel-eesti commented 2 years ago

@YauheniKapliarchuk I've tested it and I have no error

telegram-cloud-photo-size-2-5348301304176427060-y