Skip to content
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 the try_files nginx configuration) #9912

Closed
Fathurhoho opened this Issue Sep 14, 2018 · 22 comments

Comments

Projects
None yet
@Fathurhoho
Copy link

Fathurhoho commented Sep 14, 2018

Bug Description
Cannot edit a post/draft, it shows 'the editor has encountered an unexpected error'.
Screenshot:
2018-09-14_21h52_36

This happen since upgraded to Gutenberg Version 3.8.0

I've been tried to

  • Disabled all plugins (included Yoast SEO) and browser addons.
  • Attempt recovery doesn't work

Error code

    at http://ngonfig.io/wp-content/plugins/gutenberg/build/editor/index.js?ver=1536809587:12:260789
    at i (http://ngonfig.io/wp-content/plugins/gutenberg/vendor/lodash.min.59550321.js:6:91)
    at An.filter (http://ngonfig.io/wp-content/plugins/gutenberg/vendor/lodash.min.59550321.js:99:338)
    at http://ngonfig.io/wp-content/plugins/gutenberg/build/editor/index.js?ver=1536809587:12:260754
    at yh (http://ngonfig.io/wp-content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:95:430)
    at lg (http://ngonfig.io/wp-content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:120:88)
    at mg (http://ngonfig.io/wp-content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:120:386)
    at gc (http://ngonfig.io/wp-content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:127:202)
    at vb (http://ngonfig.io/wp-content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:126:230)
    at ub (http://ngonfig.io/wp-content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:126:65)

Environment

  • WordPress 4.9.8
  • Gutenberg 3.8.0
  • WordPress is running in localhost with Nginx

Now i'm working with gutenberg 3.7.0 downloaded from https://downloads.wordpress.org/plugin/gutenberg.3.7.0.zip

@Taubin

This comment has been minimized.

Copy link

Taubin commented Sep 14, 2018

I've run across the same thing on two sites running on nginx. I've posted more details on my setup here: #9876 (comment)

It seems it may be an issue with running it on nginx. I've tested with a brand new install with no plugins, on a browser with guest mode with no plugins, and get the same.

@youknowriad

This comment has been minimized.

Copy link
Contributor

youknowriad commented Sep 17, 2018

In the screenshot, I see another error above this? Is it a request error?

@Taubin In one of the old Gutenberg issues, I did see something a mention of nginx and WordPress REST API not working properly by default unless some configuration is added to nginx, but I can't seem to find it at the moment.

@Fathurhoho

This comment has been minimized.

Copy link
Author

Fathurhoho commented Sep 17, 2018

@youknowriad that errors when attempting recovery.

react-dom.min.82e21c65.js:110 TypeError: Cannot read property 'show_ui' of undefined
    at index.js?ver=1537162302:12
    at i (lodash.min.59550321.js:6)
    at An.filter (lodash.min.59550321.js:99)
    at index.js?ver=1537162302:12
    at yh (react-dom.min.82e21c65.js:95)
    at lg (react-dom.min.82e21c65.js:120)
    at mg (react-dom.min.82e21c65.js:120)
    at gc (react-dom.min.82e21c65.js:127)
    at vb (react-dom.min.82e21c65.js:126)
    at ub (react-dom.min.82e21c65.js:126)

Using old version of gutenberg is not fixed that anymore (tried 3.7.0 --> 3.6.0 --> ... ) But it's okay when i switched to apache.

@youknowriad

This comment has been minimized.

Copy link
Contributor

youknowriad commented Sep 17, 2018

@danielbachhuber Do you have more context on the Nginx REST API issues and what needs to be done there?

@danielbachhuber

This comment has been minimized.

Copy link
Member

danielbachhuber commented Sep 17, 2018

@youknowriad I don't off the top of my head, no.

@Fathurhoho Can you share the contents of the REST API response? You're looking for the taxonomies?context=edit request in the "Network" tab.

image

@Fathurhoho

This comment has been minimized.

Copy link
Author

Fathurhoho commented Sep 17, 2018

@danielbachhuber this...
2018-09-17_22h18_20

dunno how to copy-paste the json, hope the pict is clear enough

@danielbachhuber

This comment has been minimized.

Copy link
Member

danielbachhuber commented Sep 17, 2018

@Fathurhoho Yes, this is helpful. Each object on the REST API response is expected to have a visibility attribute, which has show_ui nested underneath. For some reason, yours does not (nor does it have capabilities, etc.).

To confirm, this is a basic WordPress installation with Twenty Seventeen running and no active plugins?

If so, another problem this could be is that Nginx isn't passing ?context=edit back to PHP. It seems odd the problem would manifest itself this way (that so much of WordPress could load before this becomes an issue) but a missing ?context=edit would explain why only a subset of the expected data is included in the response.

@Fathurhoho

This comment has been minimized.

Copy link
Author

Fathurhoho commented Sep 18, 2018

To confirm, this is a basic WordPress installation with Twenty Seventeen running and no active plugins?

@danielbachhuber Yes.
Now i'm using a child theme and already tried to use another theme, still no effect.

For additional information, this is health check status:

				### WordPress ###

Version: 4.9.8
Language: en_US
Permalink structure: /%postname%.html
Is this site using HTTPS?: No
Can anyone register on this site?: No
Default comment status: open
Is this a multisite?: No
User Count: 1
Communication with WordPress.org: WordPress.org is reachable
Create loopback requests: The loopback request to your site failed, this may prevent WP_Cron from working, along with theme and plugin editors.<br>Error encountered: (0) cURL error 6: Could not resolve host: ngonfig.io

### Installation size ###

Uploads Directory: 41.71 MB
Themes Directory: 3.91 MB
Plugins Directory: 16.44 MB
Database size: 2.61 MB
Whole WordPress Directory: 86.00 MB
Total installation size: 88.61 MB

### Active Theme ###

Name: Twenty Seventeen
Version: 1.7
Author: the WordPress team
Author website: https://wordpress.org/
Parent theme: Not a child theme
Supported theme features: automatic-feed-links, title-tag, post-thumbnails, menus, html5, post-formats, custom-logo, customize-selective-refresh-widgets, editor-style, starter-content, custom-header, widgets

### Other themes (4) ###

First (first): Version 2.0.4 by Takao Utsumi
First Child (firstchild): Version 2.0.4 by Fathur Saragih
Twenty Fifteen (twentyfifteen): Version 2.0 by the WordPress team
Twenty Sixteen (twentysixteen): Version 1.5 by the WordPress team

### Must Use Plugins (1) ###

Health Check Troubleshooting Mode: Version 1.5.0

### Active Plugins (1) ###

Health Check & Troubleshooting: Version 1.2.1 by The WordPress.org community

### Inactive Plugins (3) ###

Gutenberg: Version 3.8.0 by Gutenberg Team
Tabby Responsive Tabs: Version 1.2.3 by cubecolour
Yoast SEO: Version 8.2 by Team Yoast

### Media handling ###

Active editor: WP_Image_Editor_GD
Imagick Module Version: Imagick not available
ImageMagick Version: Imagick not available
GD Version: 2.2.5
Ghostscript Version: Not available

### Server ###

Server architecture: Linux 4.4.0-131-generic x86_64
PHP Version: 7.0.31-1+ubuntu16.04.1+deb.sury.org+1 (Supports 64bit values)
PHP SAPI: fpm-fcgi
PHP max input variables: 1000
PHP time limit: 30
PHP memory limit: 256M
Max input time: 60
Upload max filesize: 2M
PHP post max size: 8M
cURL Version: 7.47.0 OpenSSL/1.0.2g
SUHOSIN installed: No
Is the Imagick library available: No

### Database ###

Extension: mysqli
Server version: 5.5.5-10.0.34-MariaDB-0ubuntu0.16.04.1
Client version: mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $
Database prefix: wp_

### WordPress Constants ###

ABSPATH: /usr/share/nginx/ngonfig.net/
WP_HOME: Undefined
WP_SITEURL: Undefined
WP_DEBUG: Disabled
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG_DISPLAY: Enabled
WP_DEBUG_LOG: Disabled
SCRIPT_DEBUG: Disabled
WP_CACHE: Disabled
CONCATENATE_SCRIPTS: Undefined
COMPRESS_SCRIPTS: Undefined
COMPRESS_CSS: Undefined
WP_LOCAL_DEV: Undefined

### Filesystem Permissions ###

The main WordPress directory: Writable
The wp-content directory: Writable
The uploads directory: Writable
The plugins directory: Writable
The themes directory: Writable
The Must Use Plugins directory: Writable

nginx version

$ nginx -V
nginx version: nginx/1.10.3 (Ubuntu)
built with OpenSSL 1.0.2g  1 Mar 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads

PHP version:

$ php -v
PHP 7.2.9-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Just switched to php7.2 and still same.

@Lofesa

This comment has been minimized.

Copy link

Lofesa commented Sep 19, 2018

Hi
Same issue here
Gutember 3.8
Wordpress 4.9.8
nginx 1.15.3
php-fpm 7.1
No matter if plugins are enabled or disaled nor what theme I use.
I get this error log:
TypeError: Cannot read property 'show_ui' of undefined
at index.js:1
at i (lodash.min.59550321.js:1)
at An.filter (lodash.min.59550321.js:1)
at index.js:1
at yh (react-dom.min.82e21c65.js:95)
at lg (react-dom.min.82e21c65.js:120)
at mg (react-dom.min.82e21c65.js:120)
at gc (react-dom.min.82e21c65.js:127)
at vb (react-dom.min.82e21c65.js:126)
at ub (react-dom.min.82e21c65.js:126)
bg @ react-dom.min.82e21c65.js:110
d.function.d.componentDidCatch.c.callback @ react-dom.min.82e21c65.js:116
Jf @ react-dom.min.82e21c65.js:73
Kf @ react-dom.min.82e21c65.js:74
jc @ react-dom.min.82e21c65.js:134
gc @ react-dom.min.82e21c65.js:127
vb @ react-dom.min.82e21c65.js:126
ub @ react-dom.min.82e21c65.js:126
zd @ react-dom.min.82e21c65.js:124
ra @ react-dom.min.82e21c65.js:123
enqueueSetState @ react-dom.min.82e21c65.js:189
q.setState @ react.min.ab6b06d4.js:1
(anonymous) @ index.js:1
(anonymous) @ index.js:1
(anonymous) @ index.js:1
h @ index.js:1
(anonymous) @ index.js:1
tryCatch @ wp-polyfill-ecmascript.min.2ae96136.js:1
invoke @ wp-polyfill-ecmascript.min.2ae96136.js:1
t.(anonymous function) @ wp-polyfill-ecmascript.min.2ae96136.js:1
r @ index.js:1
c @ index.js:1
Promise.then (async)
r @ index.js:1
c @ index.js:1
Promise.then (async)
r @ index.js:1
c @ index.js:1
(anonymous) @ index.js:1
(anonymous) @ index.js:1
d @ index.js:1
y @ index.js:1
(anonymous) @ index.js:1
(anonymous) @ index.js:1
r @ index.js:1
n @ index.js:1
yh @ react-dom.min.82e21c65.js:97
lg @ react-dom.min.82e21c65.js:120
mg @ react-dom.min.82e21c65.js:120
gc @ react-dom.min.82e21c65.js:127
vb @ react-dom.min.82e21c65.js:126
ub @ react-dom.min.82e21c65.js:126
zd @ react-dom.min.82e21c65.js:124
ra @ react-dom.min.82e21c65.js:123
enqueueSetState @ react-dom.min.82e21c65.js:189
q.setState @ react.min.ab6b06d4.js:1
(anonymous) @ index.js:1
(anonymous) @ index.js:1
(anonymous) @ index.js:1
h @ index.js:1
(anonymous) @ index.js:1
tryCatch @ wp-polyfill-ecmascript.min.2ae96136.js:1
invoke @ wp-polyfill-ecmascript.min.2ae96136.js:1
t.(anonymous function) @ wp-polyfill-ecmascript.min.2ae96136.js:1
r @ index.js:1
c @ index.js:1
Promise.then (async)
r @ index.js:1
c @ index.js:1
Promise.then (async)
r @ index.js:1
c @ index.js:1
Promise.then (async)
r @ index.js:1
c @ index.js:1
Promise.then (async)
r @ index.js:1
c @ index.js:1
(anonymous) @ index.js:1
(anonymous) @ index.js:1
d @ index.js:1
y @ index.js:1
(anonymous) @ index.js:1
(anonymous) @ index.js:1
r @ index.js:1
n @ index.js:1
yh @ react-dom.min.82e21c65.js:97
lg @ react-dom.min.82e21c65.js:120
mg @ react-dom.min.82e21c65.js:120
gc @ react-dom.min.82e21c65.js:127
vb @ react-dom.min.82e21c65.js:126
ub @ react-dom.min.82e21c65.js:126
zd @ react-dom.min.82e21c65.js:124
ra @ react-dom.min.82e21c65.js:123
Id @ react-dom.min.82e21c65.js:138
kc @ react-dom.min.82e21c65.js:138
Sa.render @ react-dom.min.82e21c65.js:194
(anonymous) @ react-dom.min.82e21c65.js:141
Hd @ react-dom.min.82e21c65.js:136
mc @ react-dom.min.82e21c65.js:141
render @ react-dom.min.82e21c65.js:196
Rn @ index.js:1
(anonymous) @ post.php?post=8133&action=edit:4631

and in the nginx log, call to json are ok, like this

GET /om/wp-json/wp/v2/taxonomies?per_page=-1&context=edit HTTP/2.0" 200 256 "https://mysite.com/wp-admin/post-new.php?gutenberg-demo"

@Lofesa

This comment has been minimized.

Copy link

Lofesa commented Sep 20, 2018

Solved my issue with:

Content-Security-Policy: worker-src 'self' *.sterm.org data: blob:;

previously I have

Content-Security-Policy: worker-src 'self' data: blob: *.sterm.org ;

PD: Solved in main domain but still here in wordpress sites running as folders, but error is something different:

P.D. 2: Solved in sites running as folders. The issue was a misconfiguration in nginx:
try_files $uri $uri/ /om/index.php$is_args$args ;

The $is_args$args part are missing.

@designsimply

This comment has been minimized.

Copy link
Contributor

designsimply commented Sep 26, 2018

@Fathurhoho @Taubin, did @Lofesa's notes about Content-Security-Policy headers in nginx help you?

@Lofesa thank you for the notes!

@Zenexer

This comment has been minimized.

Copy link

Zenexer commented Oct 15, 2018

The $is_args$args addition to try_files did it for me. CSP didn't make a difference.

@designsimply designsimply changed the title The editor has encountered an unexpected error. (TypeError: Cannot read property 'show_ui' of undefined) The editor has encountered an unexpected error. (solved by updating the try_files nginx configuration) Oct 22, 2018

@benpbolton

This comment has been minimized.

Copy link

benpbolton commented Nov 19, 2018

Just a note here that nginx configuration templates don't reference try_files directives in this manner; if Gutenberg is going to require

    try_files $uri $uri/ /index.php$is_args$args;

then associated references like:

... may need updating

@choujar

This comment has been minimized.

Copy link

choujar commented Dec 10, 2018

Just to confirm, the following worked for me:

try_files $uri $uri/ /index.php$is_args$args;

@Zenexer & @benpbolton

@HoussenMoshine

This comment has been minimized.

Copy link

HoussenMoshine commented Dec 10, 2018

Hi, it's a very old bug. And try_files $uri $uri/ /index.php$is_args$args; and the CSP don't work for my yet. Note that changing the permalink to simple resolve the bug. But for now, i will not use Gutenberg until it's fully fixed.

@Luc45

This comment has been minimized.

Copy link

Luc45 commented Dec 11, 2018

I had the same issue, I'm using NGINX and indeed I was missing $args from try_files directive.

@danielbarenkamp

This comment has been minimized.

Copy link

danielbarenkamp commented Dec 21, 2018

This does not work for me.

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

Does not work ...

@daliborgogic

This comment has been minimized.

Copy link

daliborgogic commented Dec 21, 2018

@danielbarenkamp add to root

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

This comment has been minimized.

Copy link

danielbarenkamp commented Dec 21, 2018

@daliborgogic That does not work. My installation is laying in a subfolder.

@gh72029002

This comment has been minimized.

Copy link

gh72029002 commented Jan 30, 2019

My name is nginx. I use is_args to solve this problem.
old try_files $uri $uri/ index.php?Args;
new try_files $uri $uri/ index.php $is_args $args;

@leotanty

This comment has been minimized.

Copy link

leotanty commented Mar 6, 2019

Just had this error after updating to the WordPress Version 5.1

This solved my problem.
Update nginx conf file

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

@gh72029002

This comment has been minimized.

Copy link

gh72029002 commented Mar 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.