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
107 stars 14 forks source link

Using the plugin as a submodule with GitHub Actions #142

Closed johnboylesingfield closed 1 year ago

johnboylesingfield commented 1 year ago

I have failed to implement this plugin as a submodule in my deployment process. I use GitHub Actions to update files with a self-hosted runner that deploys my WordPress sites in production.

However, I have noticed that installing the plugin manually works perfectly. I will do this in the meantime, but it is unfortunately very cumbersome, as the plugin will get deleted everytime I push changes to my repository.

Is there a special process going on during the manual plugin install? Or am I doing something wrong?

Even when I try to install the plugin as a submodule after the manual installation (the version controlled files are the exact same as the ones being deleted and replaced), the plugin does not work properly. Accessing WpgraphQL IDE becomes impossible (the page tries to load forever).

I have been using the production ready files as well.

Thanks for your help!

mindctrl commented 1 year ago

@johnboylesingfield when you say you're using "production ready files", what do you mean? Can you share how you're consuming this repo exactly? I'm curious if you're running composer install during the process to create the composer autoload files?

johnboylesingfield commented 1 year ago

Oh, sorry, I meant I downloaded the latest .zip version of the plugin as mentionned in the Readme file.

Here is what I did in more details:

There is no composer.json file in this zip bundle, so I can't run composer install.

PS: The described method works well for all other plugins I have, including WPGraphQL.

johnboylesingfield commented 1 year ago

Interestingly, I tried just drag & dropping the unzipped bundle in a clean install using Local by Flywheel, and it works well.

Desactivating all other plugins I have in production does not solve the issue as well.

I'm really not sure what's going on.

mindctrl commented 1 year ago

@johnboylesingfield thanks for the extra info. What you're describing should be doable, but seems like something is going wrong somewhere. Are you able to get any debug.log messages from WP when it gets stuck on the loading screen?

mindctrl commented 1 year ago

@johnboylesingfield can you confirm the release zips for the other plugins are working correctly? There's an open issue internally for wp-graphql, wp-graphql-acf, and wp-graphql-smart-cache for fixing the zip files attached to GitHub releases here. They're unzipping without the parent folder name (with unzip in CLI. macOS creates folder name automatically, as does WP when uploaded via wp-admin), so if you're using your CI/CD pipeline to manually unzip one of those other three plugins alongside this one, that could be an issue.

johnboylesingfield commented 1 year ago

@mindctrl I can confirm the other plugins are working correctly. The plugins are not zipped when they are shipped in the pipeline. I unzip them, create a repo and then use that repo as a submodule. The end result is a Wordpress app deployed in a Docker Container.

Here are the WP logs:

[01-Aug-2023 19:37:18 UTC] PHP Warning:  include(/var/www/html/wp-content/plugins/wp-graphql-content-blocks/vendor/composer/../../includes/utilities/WPHelpers.php): Failed to open stream: No such file or directory in /var/www/html/wp-content/plugins/wp-graphql-acf/vendor/composer/ClassLoader.php on line 476
[01-Aug-2023 19:37:18 UTC] PHP Warning:  include(): Failed opening '/var/www/html/wp-content/plugins/wp-graphql-content-blocks/vendor/composer/../../includes/utilities/WPHelpers.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/wp-content/plugins/wp-graphql-acf/vendor/composer/ClassLoader.php on line 476
[01-Aug-2023 19:37:18 UTC] PHP Fatal error:  Uncaught Error: Class "WPGraphQL\ContentBlocks\Utilities\WPHelpers" not found in /var/www/html/wp-content/plugins/wp-graphql-content-blocks/includes/Registry/Registry.php:157
Stack trace:
#0 /var/www/html/wp-content/plugins/wp-graphql-content-blocks/includes/Registry/Registry.php(71): WPGraphQL\ContentBlocks\Registry\Registry->register_interface_types()
#1 /var/www/html/wp-content/plugins/wp-graphql-content-blocks/includes/WPGraphQLContentBlocks.php(180): WPGraphQL\ContentBlocks\Registry\Registry->init()
#2 /var/www/html/wp-includes/class-wp-hook.php(308): WPGraphQLContentBlocks->init_block_editor_registry(Object(WPGraphQL\Registry\TypeRegistry))
#3 /var/www/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#4 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /var/www/html/wp-content/plugins/wp-graphql/src/Registry/TypeRegistry.php(602): do_action('graphql_registe...', Object(WPGraphQL\Registry\TypeRegistry))
#6 /var/www/html/wp-includes/class-wp-hook.php(308): WPGraphQL\Registry\TypeRegistry->init_type_registry(Object(WPGraphQL\Registry\TypeRegistry))
#7 /var/www/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#8 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#9 /var/www/html/wp-content/plugins/wp-graphql/src/Registry/TypeRegistry.php(265): do_action('init_graphql_ty...', Object(WPGraphQL\Registry\TypeRegistry))
#10 /var/www/html/wp-content/plugins/wp-graphql/src/Registry/SchemaRegistry.php(38): WPGraphQL\Registry\TypeRegistry->init()
#11 /var/www/html/wp-content/plugins/wp-graphql/src/WPGraphQL.php(781): WPGraphQL\Registry\SchemaRegistry->get_schema()
#12 /var/www/html/wp-content/plugins/wp-graphql/src/Request.php(158): WPGraphQL::get_schema()
#13 /var/www/html/wp-content/plugins/wp-graphql/src/Router.php(479): WPGraphQL\Request->__construct()
#14 /var/www/html/wp-content/plugins/wp-graphql/src/Router.php(275): WPGraphQL\Router::process_http_request()
#15 /var/www/html/wp-includes/class-wp-hook.php(308): WPGraphQL\Router::resolve_http_request(Object(WP))
#16 /var/www/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#17 /var/www/html/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#18 /var/www/html/wp-includes/class-wp.php(399): do_action_ref_array('parse_request', Array)
#19 /var/www/html/wp-includes/class-wp.php(780): WP->parse_request('')
#20 /var/www/html/wp-includes/functions.php(1334): WP->main('')
#21 /var/www/html/wp-blog-header.php(16): wp()
#22 /var/www/html/index.php(17): require('/var/www/html/w...')
#23 {main}
  thrown in /var/www/html/wp-content/plugins/wp-graphql-content-blocks/includes/Registry/Registry.php on line 157

I also just tried the same thing in another (empty) WordPress site with the same deploy process. The problem remains, which points me that it is not specific to one site config.

fyi, this is the template I wrote to deploy WordPress sites on the server: https://github.com/nt2/next-wordpress-docker

Thanks for the help, it's really appreciated.

theodesp commented 1 year ago

Hey @johnboylesingfield. If you want to use the plugin like that, maybe you can just clone the repo and run composer install as part of your CI/CD steps instead. The zip file you mentioned before only bundles specific files and folders and not the whole repo so it's not suitable for rebuilding from source.