wpengine / wp-graphql-content-blocks

Plugin that extends WPGraphQL to support querying (Gutenberg) Blocks as data
https://faustjs.org/docs/gutenberg/wp-graphql-content-blocks
GNU General Public License v2.0
104 stars 13 forks source link

Critical error when installing plugin #237

Closed jaredcbaum closed 3 weeks ago

jaredcbaum commented 5 months ago

I am having trouble when installing this plugin on a fresh Wordpress deployment from Kinsta. I am running PHP 8.2 and Wordpress Version 6.5.2. This is broken on both multisite and regular deployments.

Other plugins I have installed: WPGraphQL Version 1.23.0 WPGraphQL for ACF Version 2.2.0 Advanced Custom Fields Version 6.2.9

I have been able to get around this error by:

  1. downloading the wp-graphql-content-blocks repo from GitHub
  2. manually installing dependencies with composer
  3. zipping the file
  4. uploading the zipped file to the plugins and installing

Here is a error log:

Fatal error: Uncaught Error: Class "EnforceSemVer\EnforceSemVer" not found in /www/ionicmultisite_382/public/wp-content/plugins/wp-graphql-content-blocks-no-manual-install/includes/WPGraphQLContentBlocks.php:154 Stack trace: #0 /www/ionicmultisite_382/public/wp-content/plugins/wp-graphql-content-blocks-no-manual-install/includes/WPGraphQLContentBlocks.php(32): WPGraphQLContentBlocks->includes() #1 /www/ionicmultisite_382/public/wp-content/plugins/wp-graphql-content-blocks-no-manual-install/wp-graphql-content-blocks.php(41): WPGraphQLContentBlocks::instance() #2 /www/ionicmultisite_382/public/wp-includes/class-wp-hook.php(324): wpgraphql_content_blocks_init('') #3 /www/ionicmultisite_382/public/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #4 /www/ionicmultisite_382/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /www/ionicmultisite_382/public/wp-settings.php(550): do_action('plugins_loaded') #6 /www/ionicmultisite_382/public/wp-config.php(102): require_once('/www/ionicmulti...') #7 /www/ionicmultisite_382/public/wp-load.php(50): require_once('/www/ionicmulti...') #8 /www/ionicmultisite_382/public/wp-admin/admin.php(34): require_once('/www/ionicmulti...') #9 /www/ionicmultisite_382/public/wp-admin/plugins.php(10): require_once('/www/ionicmulti...') #10 {main} thrown in /www/ionicmultisite_382/public/wp-content/plugins/wp-graphql-content-blocks-no-manual-install/includes/WPGraphQLContentBlocks.php on line 154

Notice: Function is_embed was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /www/ionicmultisite_382/public/wp-includes/functions.php on line 6078

Notice: Function is_search was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /www/ionicmultisite_382/public/wp-includes/functions.php on line 6078

ilyaAshurok commented 5 months ago

Hi, I have the save issue on Wordpress 6.5.2 with the newest release. At the same time release v3.1.2 works properly

theodesp commented 5 months ago

Hey @jaredcbaum. Does installing the plugin using the releases tab work?

jaredcbaum commented 5 months ago

Hey @jaredcbaum. Does installing the plugin using the releases tab work?

I get the same error installing version 4.0.0 and version 3.1.2 from the releases tab.

theodesp commented 5 months ago

Hey @jaredcbaum thank you. I wasn't able to reproduce this issue with Local or Hosting with WP Engine, though. I wonder if something else is going on here.

linucks commented 3 months ago

I've just encountered the same error:

Fatal error: Uncaught Error: Class "EnforceSemVer\EnforceSemVer" not found in /var/www/html/web/app/plugins/wp-graphql-content-blocks/includes/WPGraphQLContentBlocks.php:154 Stack trace: #0 /var/www/html/web/app/plugins/wp-graphql-content-blocks/includes/WPGraphQLContentBlocks.php(32): WPGraphQLContentBlocks->includes() #1 /var/www/html/web/app/plugins/wp-graphql-content-blocks/wp-graphql-content-blocks.php(41): WPGraphQLContentBlocks::instance() #2 /var/www/html/web/wp/wp-includes/class-wp-hook.php(324): wpgraphql_content_blocks_init('') #3 /var/www/html/web/wp/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #4 /var/www/html/web/wp/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /var/www/html/web/wp/wp-settings.php(550): do_action('plugins_loaded') #6 /var/www/html/web/wp-config.php(9): require_once('/var/www/html/w...') #7 /var/www/html/web/wp/wp-load.php(55): require_once('/var/www/html/w...') #8 /var/www/html/web/wp/wp-login.php(12): require('/var/www/html/w...') #9 {main} thrown in /var/www/html/web/app/plugins/wp-graphql-content-blocks/includes/WPGraphQLContentBlocks.php on line 154

The error occurs when I activate the Content Blocks plugin and completely breaks Wordpress.

I'm using:

"wp-graphql/wp-graphql": "v1.27.0"
"wpackagist-plugin/wpgraphql-acf": "2.3.0"
"wpengine/wp-graphql-content-blocks": "4.0.1"

I've included my composer.lock as an attachment: composer.lock.txt

linucks commented 3 months ago

I think I've fixed it.

I was installing via composer from the github releases page and it wasn't installing the dependencies. If I go into the wp-graphql-content-blocks folder and run composer install the error disappers.

However, installing via github is what's recommended on the currrent README, and installing with composer should be supported, so I assume that this is still a bug?

theodesp commented 3 months ago

github releases page

Interesting. This is indeed the recommended approach to install the plugin but it should be installing the dependencies and you don't have to do anything. I wonder why it fails!

justlevine commented 3 months ago

github releases page

Interesting. This is indeed the recommended approach to install the plugin but it should be installing the dependencies and you don't have to do anything. I wonder why it fails!

Pretty sure you should not use composer install to target the release page, but rather point the to the repo using the repositories as the bundled vendor files in the release zip will conflict with the ones composer installs top level.

linucks commented 3 months ago

I was installing it as a package and targetting the zip file. I updated the composer file to include:

  ...
        {
            "name": "wpengine/wp-graphql-content-blocks",
            "type": "vcs",
            "url": "https://github.com/wpengine/wp-graphql-content-blocks/"
        }
   ],
    "require": {
         "wpengine/wp-graphql-content-blocks": "4.0.1",
     .....

However, I encountered the error:

 GitHub API limit (0 calls/hr) is exhausted, could not fetch https://api.github.com/repos/wpengine/wp-graphql-content-blocks/commits/86e759cf98f9a552f1d8c2e082b758de5f6b7806. Create a GitHub OAuth token to go over the API rate limit. You can also wait until ? for the rate limit to reset.

Is there a way to avoid this as it makes deployment difficult?

And it also looks like it didn't install the dependencies either as I had to install them manually.

Could you share an examples of a composer configuration for installing it?

justlevine commented 3 months ago

Personally I drop the name, and use the one assigned in the package - also not that vcs points to the .git not a path.

{
    "type": "vcs",
    "url": "https://github.com/wpengine/wp-graphql-content-blocks.git"
},

The error you're getting is that your local machine as (ab)used the unauthenticated GitHub API too much - probably multiple subsequent runs? If you wait, it will reset, otherwise you can add your GH tokens in auth.json (this is standard composer usage and unrelated to this repo).

jasonbahl commented 3 weeks ago

Closing this as the solution regarding composer install configuration has been documented in the comments above.

justlevine commented 3 weeks ago

@jasonbahl #278 resolves the actual issue