Cornerstone bug?

I’m having trouble editing my child theme with cornerstone. The call to cornerstone-endpoint returns an array of gzipped content, but one element of the array is a null string and not JSON, which errors and potentially stops the editor loading.

Does anyone have any insights on this?

I believe its this gzipped empty JSON string that causes the error.

{“success”:true,“data”:[{“name”:“adapter::options/value::0”,“success”:true,“data”:“eNoDAAAAAAE=”,“gzip”:true},

The warning occurs here …

            return JSON.parse(t.default.inflate(n.default.decodeToByteArray(e), {
                to: "string"
            }))
        } catch (e) {
            console.warn("Failed to inflate gzip data", e)
        }
        return e
    },

Which results in this error …

    _pushInternalModel: function(e) {
        e.type
        var t = this._load(e)
        return this._setupRelationshipsForModel(t, e),
        t
    },

Uncaught TypeError: Cannot read property ‘type’ of undefined

Hi There @chruxor

Thanks for writing in! I’m sorry to hear that you’re having this issue, but you need to check the following to troubleshoot your issue.

  1. Check your WordPress version and make sure that you’re using the latest version 4.9.8. If not, you need to update your WordPress (https://codex.wordpress.org/Upgrading_WordPress).
  2. Make sure that you’re using the latest X/Pro/Cornerstone plugin (https://theme.co/apex/forum/t/troubleshooting-version-compatibility/195) and update if necessary (https://theme.co/apex/forum/t/setup-updating-your-themes-and-plugins/62)
  3. Check your PHP version and make sure that you’re running PHP v5.6.x or later to avoid incompatibility issues.
  4. Clear all caches including browser cache then deactivate your caching plugins and other optimization plugins.
  5. If you’re using a CDN, please clear the CDN’s cache and disable optimization services.
  6. Test for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.
  7. Remove custom CSS, Javascript and templates.
  8. Reset your htaccess file by renaming it to .htaccess-bak. Then in WP Admin Menu, go to Settings > Permalinks and just click the Save Changes button.

Re-test your issues after that and let us know how it goes.

Thanks!

Hi,

I have tried all of that. As you can see in the code, it doesn’t correctly handle the case when the gzip data isn’t a valid JSON string. So there are two issues here, one is why the string is empty in the call to /corenerstone-endpoint and the second is a lack of error handling in the JavaScript for the empty string.

Thanks,

Martyn

Hi Martyn,

You can login through FTP then edit the wp-config.php file and find the line: define( 'WP_DEBUG', false );. Set it to true then save the file. Log back in the admin area and you should be able to see some more error information when you redo the steps you are having issues with.

If you are getting an error message that suggests: Fatal error: Allowed memory size of xxxxx bytes exhausted, it means that you need to have the PHP memory limit of your site increased.

To do this, please edit your wp-config.php file and insert these lines:

define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

You can add it before the line
/*That's all, stop editing! Happy Blogging. */

In case the issue persists, please try to get in touch with your hosting provider and confirm to them that your PHP memory limit is increased.

If you are still having an issue, please provide us with the admin details of your site in a Secure Note so that we can check this further.

There are no errors in the debug log and the OS has plenty of resources available. As I said previously one of the issues is a bug in the JavaScript so not related to any of this.

Hi There @chruxor

At this point, it’s hard to guess without actually checking your site. However I can provide further troubleshooting steps, if you’re not in position to share your login credentials.

  1. GZipped error usually means that you’re having some issue with your caching plugin or server configurations. If you have already test your caching plugin by disabling it, you can then check any server configurations related to gzip.
  2. Remove any custom JavaScript code that you added to the site, if you haven’t done already. Also if you’re using a child theme, switch to your parent theme by activating it. If the issue resolved, you need to check your child theme customizations.

If you’re still having issues, I would suggest you to delete both of your X theme and Cornerstone plugin and re-install it with a fresh copy. To do that, you can first switch to a default WordPress theme and then delete your X theme. Then you need to delete Cornerstone plugin from your plugins section as well. Then download the latest version of X theme from your Envato account and install it again through WordPress backend. Cornerstone plugin will be automatically installed after that. Once you have a fresh copy, try testing your issues again and see if you’re getting the same error.

To see whether your issue is related to your server configurations, I would suggest you to migrate a copy of your site into a different server and test. You can use a free account of this service (https://pantheon.io/) and then follow our migration guide here to setup a copy of your site. Once you have migrated your site, try testing your issues again.

Let us know how it goes.
Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.