Support » Fixing WordPress » Gutenberg “Updating Failed”

  • Resolved metrostudios

    (@metrostudios)


    Alright, I’ve looked through every post I can find about this error and haven’t found any useful solutions so I guess I’ll make my own post.

    We have a dev site that has WordPress 5.0.2 installed and its running on PHP 7.0.33. It is a fresh install with 2 plugins but no plugins are active at this time. When attempting to create a page/post it throws an “Updating Failed” or a “Publishing Failed” error. I also cannot preview anything but I think this has something to do with WordPress not having a save to pull the preview from so I think this is a symptom of the main updating failed issue.

    First I had issues with 404’s coming from the REST API calls but I ended up getting that resolved. Server logs are not throwing any errors at all after that. I am getting Javascript errors though:

    Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

    redux-routine.min.js?ver=3.0.3:1 Uncaught (in promise) Error: [object Object]

    Those errors show up immediately upon loading the page.

    I get another Javascript error when I click the editor to start typing:

    editor.min.js?ver=9.0.6:12 Uncaught (in promise) {code: "invalid_json", message: "The response is not a valid JSON response."}

    The javascript errors have an arrow that expands to show more information but I’m not sure its very helpful information. Here is a sample of what all of it looks like:

    	Promise.then (async)		
    n	@	data.min.js?ver=4.1.0:1
    c	@	data.min.js?ver=4.1.0:1
    (anonymous)	@	data.min.js?ver=4.1.0:1
    (anonymous)	@	data.min.js?ver=4.1.0:1
    a	@	data.min.js?ver=4.1.0:1
    (anonymous)	@	data.min.js?ver=4.1.0:1
    (anonymous)	@	data.min.js?ver=4.1.0:1
    (anonymous)	@	editor.min.js?ver=9.0.6:55
    n	@	data.min.js?ver=4.1.0:1

    and that sort of stuff continues for many lines.

    The network tab has all status code 200’s and 304’s.

    I’m using Chrome. I thought it might be some weird Chrome Extension thing but I opened an incognito window that has no browser extensions and had the same issues.

    I think I covered everything in here, let me know if there is any more information I can provide that may be helpful, I’m all ears at this point.

    Thanks,
    Travis

Viewing 15 replies - 1 through 15 (of 21 total)
  • > The network tab has all status code 200’s and 304’s.

    What do the actual REST API responses look like? Because it sounds like not the wrong information is returned from the server, leading to these errors. A copy of the responses from the Network tab or at least a screenshot would help.

    200 just means you got a response. It doesn’t mean it’s the right one though, hence the question 🙂

    @swissspidy

    https://gyazo.com/fc1fe3aa0a04161b8c46990058a0ef6a

    I don’t think this is exactly what you meant. I guess how can I tell the REST API calls apart from all of the other ones and also I’m assuming you are looking for what is in the Response tab correct?

    You can click on “XHR” to filter async request to the REST API only. The UI should look like this: https://cloudup.com/ctrVfdDqNh7

    If you check the “Headers” tab, you’ll see /wp-json/… in the URL, indicating that it’s a REST API request.

    Responses should start with [{… or {….

    If there were any server errors or similar, the responses would start with Warning:…, which isn’t a good sign.

    Ideally, go through all the ~10 requests and check the responses for anything odd.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    We have a dev site that has WordPress 5.0.2 installed and its running on PHP 7.0.33. It is a fresh install with 2 plugins but no plugins are active at this time.

    How, exactly, did you create this fresh install? What steps did you take? Did you use an automatic installer like Softtaculous or cPanel or something, or did you do it yourself?

    Also, what are the contents of your .htaccess file?

    @swissspidy

    Okay, so something is definitely off. None of the autosaves or the manual saves (clicking update) are returning anything as you said.

    https://gyazo.com/a10065bf5d556862a7290387a615d8b1

    They are all returning this. The only one that starts with a JSON like object are ones for admin-ajax.

    @otto42

    Downloading tar.gz file and manually installing it. I’ve done it a bunch with older versions of WordPress and haven’t had anything weird with those but maybe something is different with this one as far as permissions or something.

    .htaccess looks like:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    

    also as far as .htaccess files go, I’m a big noob. I didn’t create any of these rules or anything so no idea what they do or why they are there.

    • This reply was modified 5 months, 3 weeks ago by  metrostudios.
    • This reply was modified 5 months, 3 weeks ago by  metrostudios.
    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Where did you get that truly bizarre .htaccess file?

    Also, do you have non-default permalinks enabled? Like any of the settings on Settings->Permalinks that aren’t the “Plain” one. You want one of those to be enabled, and then you want the normal WordPress ruleset in your .htaccess file.

    Without the htaccess rules being properly set, then I doubt the REST API will work with those rules. You don’t have an index.php fallback.

    @otto42

    So I totally clicked on the wrong site files and gave you a .htaccess for a completely different website.

    Here is the correct .htaccess file:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    also for the permalinks we are using “Post name”

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Okay, that looks more normal. Well, it was worth checking anyway.

    @swissspidy

    Ok not sure what changed but I left the page and came back and now I am getting a JSON response for all of them:

    [{"id":1,"name":"metrostudios","url":"","description":"","link":"http:\/\/bieribrokerage.metro-studios.com\/blog\/author\/metrostudios\/","slug":"metrostudios","avatar_urls":{"24":"http:\/\/0.gravatar.com\/avatar\/3b17038fff8c1a3f464937d771acc5df?s=24&d=mm&r=g","48":"http:\/\/0.gravatar.com\/avatar\/3b17038fff8c1a3f464937d771acc5df?s=48&d=mm&r=g","96":"http:\/\/0.gravatar.com\/avatar\/3b17038fff8c1a3f464937d771acc5df?s=96&d=mm&r=g"},"meta":[],"_links":{"self":[{"href":"http:\/\/bieribrokerage.metro-studios.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"collection":[{"href":"http:\/\/bieribrokerage.metro-studios.com\/blog\/wp-json\/wp\/v2\/users"}]}}]<!-- Execution Time: 0.03705 seconds -->
    <!-- Peak Memory Usage: 4,096.00 KB -->
    <!-- SQL Queries: 1 -->
    {"category":{"name":"Categories","slug":"category","capabilities":{"manage_terms":"manage_categories","edit_terms":"edit_categories","delete_terms":"delete_categories","assign_terms":"assign_categories"},"description":"","labels":{"name":"Categories","singular_name":"Category","search_items":"Search Categories","popular_items":null,"all_items":"All Categories","parent_item":"Parent Category","parent_item_colon":"Parent Category:","edit_item":"Edit Category","view_item":"View Category","update_item":"Update Category","add_new_item":"Add New Category","new_item_name":"New Category Name","separate_items_with_commas":null,"add_or_remove_items":null,"choose_from_most_used":null,"not_found":"No categories found.","no_terms":"No categories","items_list_navigation":"Categories list navigation","items_list":"Categories list","most_used":"Most Used","back_to_items":"&larr; Back to Categories","menu_name":"Categories","name_admin_bar":"category"},"types":["post"],"show_cloud":true,"hierarchical":true,"rest_base":"categories","visibility":{"public":true,"publicly_queryable":true,"show_admin_column":true,"show_in_nav_menus":true,"show_in_quick_edit":true,"show_ui":true},"_links":{"collection":[{"href":"http:\/\/bieribrokerage.metro-studios.com\/blog\/wp-json\/wp\/v2\/taxonomies"}],"wp:items":[{"href":"http:\/\/bieribrokerage.metro-studios.com\/blog\/wp-json\/wp\/v2\/categories"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},"post_tag":{"name":"Tags","slug":"post_tag","capabilities":{"manage_terms":"manage_post_tags","edit_terms":"edit_post_tags","delete_terms":"delete_post_tags","assign_terms":"assign_post_tags"},"description":"","labels":{"name":"Tags","singular_name":"Tag","search_items":"Search Tags","popular_items":"Popular Tags","all_items":"All Tags","parent_item":null,"parent_item_colon":null,"edit_item":"Edit Tag","view_item":"View Tag","update_item":"Update Tag","add_new_item":"Add New Tag","new_item_name":"New Tag Name","separate_items_with_commas":"Separate tags with commas","add_or_remove_items":"Add or remove tags","choose_from_most_used":"Choose from the most used tags","not_found":"No tags found.","no_terms":"No tags","items_list_navigation":"Tags list navigation","items_list":"Tags list","most_used":"Most Used","back_to_items":"&larr; Back to Tags","menu_name":"Tags","name_admin_bar":"post_tag"},"types":["post"],"show_cloud":true,"hierarchical":false,"rest_base":"tags","visibility":{"public":true,"publicly_queryable":true,"show_admin_column":true,"show_in_nav_menus":true,"show_in_quick_edit":true,"show_ui":true},"_links":{"collection":[{"href":"http:\/\/bieribrokerage.metro-studios.com\/blog\/wp-json\/wp\/v2\/taxonomies"}],"wp:items":[{"href":"http:\/\/bieribrokerage.metro-studios.com\/blog\/wp-json\/wp\/v2\/tags"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}}<!-- Execution Time: 0.03366 seconds -->
    <!-- Peak Memory Usage: 4,096.00 KB -->
    <!-- SQL Queries: 1 -->

    When clicking update it gives the updating error still but if I leave the page and go back to the same post it tells me there is a more recent version of the post in an autosave.

    I can publish pages/posts even though I get an error “publishing failed”. I leave the page and look at the posts/pages and its there. The preview feature still doesn’t work though.

    • This reply was modified 5 months, 3 weeks ago by  metrostudios.
    • This reply was modified 5 months, 3 weeks ago by  metrostudios.
    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Okay, so something is definitely off. None of the autosaves or the manual saves (clicking update) are returning anything as you said.

    https://gyazo.com/a10065bf5d556862a7290387a615d8b1

    They are all returning this. The only one that starts with a JSON like object are ones for admin-ajax.

    Wait, what is the structure of your site? Do you have WordPress in a subdirectory?

    Looking at the results there, that source code doesn’t look like a WordPress page. But your rewrite rules, indicate that WordPress is installed in the root of the site.

    Is there some kind of mismatch in the URLs here?

    @otto42

    Yes, WordPress is installed in a subdirectory right below the root directory. The main website is in a different CMS and WordPress is installed in a directory “blog”.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Okay. So on the Settings->General Page, what are the values for “WordPress Address (URL)” and “Site Address (URL)” set to?

    If those values aren’t both set to have /blog at the end of them, then you’ve probably set it up wrong.

    @otto42

    They both have /blog at the end.

    So here is something interesting I discovered that may or may not help. I looked at the responses for one of the autosaves which seem to be working and it gives a URL for the preview and I put that in the browser and it works, the preview shows up but if you click preview on the post page it just spins and spins infinitely.

Viewing 15 replies - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.