-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 - Cannot read property 'rest_base' of undefined #9381
Comments
Thank you for including clear details and a screenshot! I am able to run Gutenberg 3.6.2 without error, so I believe the problem in your case may be due to a conflict with server settings or possibly a conflict with a plugin. Are you able to temporarily turn off all other plugins and check to see if the error still happens? This will help rule out a plugin conflict. I also noticed a similar-sounding error in #8802 where the problem turned out to be related to custom rewrite rules. Do you have anything like that setup on your web server which could be causing the trouble in this case? |
@designsimply I should have stated that I am not running any other plugins and using the latest Twenty Seventeen theme. The only other thing to note is I am running WordPress in it's own directory /wp/ so admin sits at /wp/wp-admin. Though, I just did a fresh install of Wordpress 4.9.8 on it's own (regular install) with only the Gutenberg plugin installed and activated and I am getting the same error. I made a recording of the issue > https://www.dropbox.com/s/so8hn1nbr3e18ue/Gutenberg%20Error.mov?dl=0 Update* I can reproduce this error on the live site > https://letsshareinc.org/ |
Looks like something related to the REST API, something (a plugin, a firewall, Cloudflare) is probably touching the REST API in the wrong way. I can't say more than that. |
@youknowriad The thing is I am not using any other plugins, I do not have a firewall, and aside from the live site there is no caching. |
Maybe a server config but I don't know. It would be good to find the source of this kind of issues though. Other persons might experience it and think Gutenberg is completely broken while it's not :) Maybe you can try to dump the |
@youknowriad Here is a dump of $preload_data > https://gist.github.com/styledev/fccd3f996eec7b2033f8f541baacf8f0 Honestly, it looks like the culprit for all of this is that the settings sidebar does not exist if you load the page when the user has set the state of it to hidden. The initial "Add Page" load on a fresh install has the Settings sidebar shown and everything works fine. If you load in with out the Settings open then this issue occurs but if you click the Settings button first and then again to close it the issue does not happen. |
The preload data looks ok. You're saying the issue happens when you open or close the sidebar. Can you monitor the network requests triggered when this happens and paste their responses here. (Essentially requests to |
@youknowriad Have you watched the video I attached up above of the issue? Reproduce Error
Error does not happen if you do:
Error also does not happen if you do:
|
Yes, but I can't reproduce personally. |
@RickorDD To note this issue was first reported by me in regards to Pages, not posts. Pages do not have categories. That said I defined SCRIPT_DEBUG as true and here is a better error from the unminified JS files in Gutenberg. I dug a little bit and seems to be an issue in the Vendor plugin http://www.jacklmoore.com/autosize/. https://gist.github.com/styledev/c957fe8f56eca939ff88f7458d2ff409 |
This is just a warning, the real issue is the |
@youknowriad Yeah, the issue has always been trying to access "rest_base" on an object that is undefined. If you have the Settings sidebar this error does not happen so it goes to reason that the object that "rest_base" is being called on is only defined if the Settings area has been initiated. Please also note, while I am a programmer and have been learning React I have not been digging into the Gutenberg core code. I am just trying to support you on the error side. I hope everyone now has enough information. It is curious though that you can't recreate the error when I have no problem doing so both locally with a fresh WP and Gutenberg instance and on a production site. |
I know and you're already helping a lot, I can now try "to guess" what might break. I'll plan to take a deeper look in the code soon and see if there's anything suspicious 🤷♂️ . |
@RickorDD Changing my permalink structure to "Plain" did not solve this issue for me. |
I'm also experiencing same issue, Previously it was fine and I have made 2 articles with guttenberg. It seems getting conflict with Yoast SEO plugin, it works fine when i disabled Yoast SEO plugin.
This happens when 'add new' and 'edit' any post.
|
@styledev I tried testing this again today using a test site created at https://jurassic.ninja/ and could not see the error happen in my testing. I used these steps from one of your earlier comments: Reproduce Error I ran my test using WordPress 5.0.3 and no active plugins and I used Safari 12.0.3 on macOS 10.13.6. Are you still seeing the "Cannot read property 'rest_base' of undefined" error after updating to the latest version of WordPress (5.0.3 at the time of this writing)? Since you mentioned that you are not running any other plugins and that you used the latest Twenty Seventeen theme at the time of testing, I feel in that case it has got to be related to something in your server config… 🕵️♀️ are you able to try testing using https://jurassic.ninja/ as a check? Can you think of anything related to your server config or firewall that could have been blocking the REST API inadvertently? |
@Fathurhoho thanks for chiming in! I see that the error from your video and screenshot is different than the one @styledev mentioned.
Just below your error, the |
@latereverafter there's not quite enough information to go on from the error you posted.
First, can you update to the latest version of WordPress and also make sure that all of your plugins have been updated to their latest versions? If you're still having trouble after that, a good place to start will be to temporarily deactivate all active plugins and try the test again. If you're still seeing problems, please post all of the relevant details you've tried, note the latest version of WordPress you've tested with, and if possible include a copy/paste or a screenshot of the full error from the console panel in your browser's web developer tools to https://wordpress.org/support/forum/how-to-and-troubleshooting/ If you are not sure how to get the information needed for a bug report, the support forums are the very best place to ask for help with troubleshooting steps for that. Thank you! |
Closing as this error is not present in the core version of Wordpress 5. |
I have the same issue with gutenberg. It's not caused by yoast since it's been deactivated. Leaving to classic editor for now! |
Similar thing was happening to me with WordPress 5.9 RC3. and changing permalinks to default helped. Tracking back to the issue, I found out that nginx.conf had this line
The $ was missing in args.. after I added $, the issue is resolved and there is no longer react dom error.
|
Describe the bug
When you create a new page and click [Publish...] for the first time I get an error/modal prompt that states: "The editor has encountered an unexpected error. [Attempt Recovery] [Copy Post Text] [Copy Error]"
The console shows the following error at the same time:
react-dom.min.82e21c65.js:110 TypeError: Cannot read property 'rest_base' of undefined
at index.js?ver=1534535888:12
at r (index.js?ver=1534535888:1)
at new e (index.js?ver=1534535888:1)
at yh (react-dom.min.82e21c65.js:97)
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)
at wg (react-dom.min.82e21c65.js:137)
If you click [Attempt Recovery] the editor comes back and when you click [Publish...] the page will save. If you then change the page back to a draft, refresh the browser, and click [Publish...] you will get the error again.
TO NOTE: I just realized that if you open up the "Settings" (Shift + CMD + ,) and then click [Publish...] the page published as expected. It seems that the error stems from the Settings panel not being present. Works even if you close the settings then click [Publish...].
To Reproduce
Steps to reproduce the behavior:
6 Click [Publish] button
Expected behavior
The expected behavior is for the page to be published and a green confirmation notice that says "Post published! View post"
Screenshots
Error: https://www.dropbox.com/s/coy9ekr51vciiiz/20180827-wordpress-4.9.8-gutenberg-v3.6.2-unexpected-error.png?dl=0
Desktop:
Additional context
WordPress v. 4.9.8
Gutenberg v. 3.6.2
Safari and Firefox seem to state slightly different console error text.
The text was updated successfully, but these errors were encountered: