New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The editor has encountered an unexpected error (solved by updating nginx config) #12696

Closed
nielsk opened this Issue Dec 8, 2018 · 10 comments

Comments

Projects
None yet
2 participants
@nielsk
Copy link

nielsk commented Dec 8, 2018

I installed Wordpress 5.0 and when I try to use the Block Editor (formerly gutenberg afaik) I get this message: The editor has encountered an unexpected error.
Copied error:

this.wp.editor</Hs</<@https://my.domain.tld/wp-includes/js/dist/editor.min.js?ver=9.0.4:55:239952
i@https://my.domain.tld/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:6:91
x/An.filter@https://my.domain.tld/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:99:327
this.wp.editor</Hs<@https://my.domain.tld/wp-includes/js/dist/editor.min.js?ver=9.0.4:55:239921
ph@https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:97:88
eg@https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:125:307
fg@https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:126:168
wc@https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:237
fa@https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:115
gg@https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:135:196
Ca@https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:133:365
enqueueSetState@https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:191:324
q.prototype.setState@https://my.domain.tld/wp-includes/js/dist/vendor/react.min.js?ver=16.6.3:20:291
value@https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:13979
n/<@https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:10354
n@https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:10325
g/<.subscribe</<@https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:8324
b@https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:19536
y/</<@https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:5320
v/</</<@https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:5748
l/</</<@https://my.domain.tld/wp-includes/js/dist/redux-routine.min.js?ver=3.0.3:1:9095
dispatch@https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:22001
a/<@https://my.domain.tld/wp-includes/js/dist/redux-routine.min.js?ver=3.0.3:1:8676
r/<@https://my.domain.tld/wp-includes/js/dist/redux-routine.min.js?ver=3.0.3:1:4477
r@https://my.domain.tld/wp-includes/js/dist/redux-routine.min.js?ver=3.0.3:1:4451
u/<@https://my.domain.tld/wp-includes/js/dist/redux-routine.min.js?ver=3.0.3:1:4406
j/</<@https://my.domain.tld/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=7.0.0:2:29352
j/<@https://my.domain.tld/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=7.0.0:2:29220
f@https://my.domain.tld/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=7.0.0:1:20743

Wordpress Health Check doesn't show any problems. Even in Troubleshooting-mode I get this error.
When I create a new post it seems like I see the interface for less than a second and then the above crash is shown.

@designsimply

This comment has been minimized.

Copy link
Contributor

designsimply commented Dec 8, 2018

Thank you fo reporting this! Would it be possible for you to check the console in your browser's web developer tools and let me know if there is an error that is more specific compared to what you're seeing in the copied error from the UI?

Also, can you tell me if you are using default or custom permalinks? If you change the permalink structure, does it resolve the problem? (This is a guess because I've seen other similar reports caused by updating rewrite rules on the server side and I can't yet tell in your case if it's the same without knowing a bit more info—and I thought it be worth a quick check!)

@nielsk

This comment has been minimized.

Copy link

nielsk commented Dec 8, 2018

Sure:

JQMIGRATE: Migrate is installed, version 1.4.1 load-scripts.php:9:542
TypeError: "e.visibility is undefined"
	Hs https://my.domain.tld/wp-includes/js/dist/editor.min.js?ver=9.0.4:55:239952
	i https://my.domain.tld/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:6:91
	filter https://my.domain.tld/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:99:327
	Hs https://my.domain.tld/wp-includes/js/dist/editor.min.js?ver=9.0.4:55:239921
	ph https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:97:88
	eg https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:125:307
	fg https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:126:168
	wc https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:237
	fa https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:115
	gg https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:135:196
	Ca https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:133:365
	enqueueSetState https://my.domain.tld/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:191:324
	setState https://my.domain.tld/wp-includes/js/dist/vendor/react.min.js?ver=16.6.3:20:291
	value https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:13979
	n https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:10354
	n https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:10325
	subscribe https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:8324
	b https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:19536
	y https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:5320
	v https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:5748
	l https://my.domain.tld/wp-includes/js/dist/redux-routine.min.js?ver=3.0.3:1:9095
	dispatch https://my.domain.tld/wp-includes/js/dist/data.min.js?ver=4.0.1:1:22001
	a https://my.domain.tld/wp-includes/js/dist/redux-routine.min.js?ver=3.0.3:1:8676
	r https://my.domain.tld/wp-includes/js/dist/redux-routine.min.js?ver=3.0.3:1:4477
	r https://my.domain.tld/wp-includes/js/dist/redux-routine.min.js?ver=3.0.3:1:4451
	u https://my.domain.tld/wp-includes/js/dist/redux-routine.min.js?ver=3.0.3:1:4406
	j https://my.domain.tld/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=7.0.0:2:29352
	j https://my.domain.tld/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=7.0.0:2:29220
	f https://my.domain.tld/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=7.0.0:1:20743
react-dom.min.js:104:245
Firefox can’t establish a connection to the server at wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data. rest-proxy:6:4259 

I use the option "Day and Name" as permalink-structure. So I wouldn't consider it "custom" since it is one of the common options WP is giving me.
After switching to Plain the block editor works. But I actually wouldn't want to switch my permalink-structure after using this blog for such a long time.

@nielsk

This comment has been minimized.

Copy link

nielsk commented Dec 8, 2018

After switching to Plain I still see these messages in the browser console:

JQMIGRATE: Migrate is installed, version 1.4.1 load-scripts.php:9:542
Firefox can’t establish a connection to the server at wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data.
rest-proxy:6:4259JQMIGRATE: Migrate is installed, version 1.4.1 load-scripts.php:9:542
Firefox can’t establish a connection to the server at wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data.
rest-proxy:6:4259


@nielsk

This comment has been minimized.

Copy link

nielsk commented Dec 9, 2018

I tried now other permalink-structures and the only one that worked is "Plain".

@nielsk

This comment has been minimized.

Copy link

nielsk commented Dec 9, 2018

Looking at #2596 and there seems to be something similar.

I am using nginx 1.14.2 on FreeBSD 11.2-RELEASE-p5

@nielsk

This comment has been minimized.

Copy link

nielsk commented Dec 9, 2018

In the nginx-logs I see:

???.???.???.??? - - [09/Dec/2018:07:28:02 +0100] "POST /wp-admin/admin-ajax.php HTTP/2.0" 200 1 "https://my.domain.tld/wp-admin/post-new.php" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0"
???.???.???.??? - - [09/Dec/2018:07:28:03 +0100] "GET /wp-admin/post-new.php HTTP/2.0" 200 361305 "https://my.domain.tld/wp-admin/post-new.php" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0"
???.???.???.??? - - [09/Dec/2018:07:28:03 +0100] "GET /wp-admin/admin-ajax.php?action=atd_settings&ver=20150715 HTTP/2.0" 200 374 "https://my.domain.tld/wp-admin/post-new.php" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0"
???.???.???.??? - - [09/Dec/2018:07:28:03 +0100] "GET /wp-content/plugins/syndication-links/js/synlinks.js?ver=4.0.3 HTTP/2.0" 304 0 "https://my.domain.tld/wp-admin/post-new.php" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0"
???.???.???.??? - - [09/Dec/2018:07:28:04 +0100] "GET /wp-json/jetpack/v4/jitm?message_path=wp%3Apost%3Aadmin_notices&query=&_wpnonce=b0365e133a HTTP/2.0" 200 2 "https://my.domain.tld/wp-admin/post-new.php" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0"
???.???.???.??? - - [09/Dec/2018:07:28:04 +0100] "GET /wp-json/wp/v2/users/?who=authors&per_page=100&_locale=user HTTP/2.0" 200 1939 "https://my.domain.tld/wp-admin/post-new.php" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0"
???.???.???.??? - - [09/Dec/2018:07:28:04 +0100] "GET /wp-json/wp/v2/taxonomies?context=edit&_locale=user HTTP/2.0" 200 780 "https://my.domain.tld/wp-admin/post-new.php" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0"
???.???.???.??? - - [09/Dec/2018:07:28:05 +0100] "GET /wp-json/wp/v2/taxonomies?per_page=100&context=edit&_locale=user HTTP/2.0" 200 780 "https://my.domain.tld/wp-admin/post-new.php" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0"

@nielsk

This comment has been minimized.

Copy link

nielsk commented Dec 9, 2018

I got it to work.
I had to do the following in my nginx-config:
Change:

       location / {
        try_files $uri $uri/ /index.php;
        }

to

       location / {
        try_files $uri $uri/ /index.php$is_args$args;
        }

and add

       location ~ ^/wp-json/ {
    # if permalinks not enabled
    rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
}

@nielsk

This comment has been minimized.

Copy link

nielsk commented Dec 9, 2018

Ok, it works I just published succesfully a post privately.

@nielsk nielsk closed this Dec 9, 2018

@nielsk nielsk reopened this Dec 9, 2018

@nielsk

This comment has been minimized.

Copy link

nielsk commented Dec 9, 2018

So my bug report would be that you need to inform people on changing their config if they use nginx and link them to some part of the documentation where this is described.

@designsimply

This comment has been minimized.

Copy link
Contributor

designsimply commented Dec 20, 2018

Thank you for documenting the nginx config updates that fixed this issue for you!

I am not sure whether WP can detect the nginx config is wrong and show a prompt asking for it to be checked but that is a question you might consider asking in Core Trac at https://core.trac.wordpress.org/ since web server config can be done in so many different ways.

I checked for documentation and found the following under the "General WordPress rules" heading at https://codex.wordpress.org/Nginx

    location / {
            # This is cool because no php is touched for static content.
            # include the "?$args" part so non-default permalinks doesn't break when using query string
            try_files $uri $uri/ /index.php?$args;
    }

And at https://www.nginx.com/blog/installing-wordpress-with-nginx-unit/ I found this:

location / {
    try_files $uri @index_php;
}

These documentations show that you can configure the server in a few different ways and still have everything working.

Aside: the error related to can’t establish a connection to the server at wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data has to do with Jetpack and was reported at Automattic/jetpack#9170.

@designsimply designsimply changed the title The editor has encountered an unexpected error The editor has encountered an unexpected error (solved by updating nginx config) Dec 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment