WebDevStudios / nextjs-wordpress-starter

A headless starter for WordPress powered by Next.js.
https://webdevstudios.github.io/nextjs-wordpress-starter/
GNU General Public License v2.0
735 stars 129 forks source link

ACF Block causing issue when placed. #394

Closed sloyer closed 3 years ago

sloyer commented 3 years ago

Describe the bug When I place an ACFMediaText block it causes the the whatever page its on to do weird things

If Homepage: "To display your WordPress homepage dynamically, set your homepage to a static page via the WP dashboard (Settings: Reading Settings)."

If a random page It goes to the 404 page.

Normal blocks will show up as normal without the ACFBlock, Paragraph and image work fine as long as ACFBlock isnt there, soon as I place it freaks out.

To Reproduce This is a fresh install. Homepage is set to the homepage Blogs set to posts

404 is configured.

Slug structure is /blog/%postname%/

.env is set up

sloyer commented 3 years ago

It appears whenever that block is dropped in the JSON becomes null for blocks

{ "title": "Homepage", "authorDatabaseId": 1, "pageId": 301, "blocks": null }, { "title": "This is a Page For you", "authorDatabaseId": 1, "pageId": 249, "blocks": [ { "attributesJSON": "{\"content\":\"Hey man, can I sell you some page? dfsdfdsfsdfsf\",\"dropCap\":false,\"anchor\":\"\"}" } ] }, { "title": "Sample Page", "authorDatabaseId": 1, "pageId": 2, "blocks": [ { "attributesJSON": "{\"content\":\"This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:\",\"dropCap\":false,\"anchor\":\"\"}" }, { "attributesJSON": "{\"content\":\"Search below\",\"dropCap\":false,\"anchor\":\"\",\"align\":\"center\"}" }, { "attributesJSON": "{\"content\":\"fdsfdsafsasddsa\",\"level\":1,\"anchor\":\"\",\"textAlign\":\"center\",\"backgroundColor\":\"black\",\"textColor\":\"pale-pink\",\"fontSize\":\"huge\"}" } ] } ] } },

sloyer commented 3 years ago

Also noticing im an internal server error when i drop it.

query MyQuery { pages { nodes { blocks { attributesJSON ... on AcfAcfMediaTextBlock { attributesJSON dynamicContent } } title } } }

Response:

{ "errors": [ { "message": "Internal server error", "extensions": { "category": "internal" }, "locations": [ { "line": 4, "column": 7 } ], "path": [ "pages", "nodes", 2, "blocks" ] } ], "data": { "pages": { "nodes": [ { "blocks": [ { "attributesJSON": "{\"content\":\"BIIIITCH\",\"dropCap\":false,\"anchor\":\"\"}" } ], "title": "404" }, { "blocks": [], "title": "Blog" }, { "blocks": null, "title": "Homepage" }, { "blocks": [ { "attributesJSON": "{\"content\":\"Hey man, can I sell you some page? dfsdfdsfsdfsf\",\"dropCap\":false,\"anchor\":\"\"}" } ], "title": "This is a Page For you" }, { "blocks": [ { "attributesJSON": "{\"content\":\"This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:\",\"dropCap\":false,\"anchor\":\"\"}" }, { "attributesJSON": "{\"content\":\"Search below\",\"dropCap\":false,\"anchor\":\"\",\"align\":\"center\"}" }, { "attributesJSON": "{\"content\":\"fdsfdsafsasddsa\",\"level\":1,\"anchor\":\"\",\"textAlign\":\"center\",\"backgroundColor\":\"black\",\"textColor\":\"pale-pink\",\"fontSize\":\"huge\"}" } ], "title": "Sample Page" } ] } }, "extensions": { "debug": [ { "type": "DEBUG_LOGS_INACTIVE", "message": "GraphQL Debug logging is not active. To see debug logs, GRAPHQL_DEBUG must be enabled." } ] } }

sloyer commented 3 years ago

Updated with debug

"errors": [ { "debugMessage": "get_object_vars(): Argument #1 ($object) must be of type object, array given", "message": "Internal server error", "extensions": { "category": "internal" }, "locations": [ { "line": 4, "column": 7 } ], "path": [ "pages", "nodes", 0, "blocks" ], "trace": [ { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php", "line": 1792, "function": "get_object_vars()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php", "line": 953, "call": "Opis\\JsonSchema\\Validator::validateObject()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php", "line": 519, "call": "Opis\\JsonSchema\\Validator::validateProperties()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php", "line": 332, "call": "Opis\\JsonSchema\\Validator::validateKeywords()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php", "line": 1915, "call": "Opis\\JsonSchema\\Validator::validateSchema()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php", "line": 953, "call": "Opis\\JsonSchema\\Validator::validateObject()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php", "line": 519, "call": "Opis\\JsonSchema\\Validator::validateProperties()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php", "line": 332, "call": "Opis\\JsonSchema\\Validator::validateKeywords()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php", "line": 97, "call": "Opis\\JsonSchema\\Validator::validateSchema()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/src/Blocks/Block.php", "line": 151, "call": "Opis\\JsonSchema\\Validator::schemaValidation()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/src/Blocks/Block.php", "line": 183, "call": "WPGraphQLGutenberg\\Blocks\\Block::parse_attributes()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/src/Blocks/Block.php", "line": 25, "call": "WPGraphQLGutenberg\\Blocks\\Block::__construct()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql-gutenberg/src/Schema/Types/InterfaceType/BlockEditorContentNode.php", "line": 28, "call": "WPGraphQLGutenberg\\Blocks\\Block::create_blocks()" }, { "call": "WPGraphQLGutenberg\\Schema\\Types\\InterfaceType\\BlockEditorContentNode::WPGraphQLGutenberg\\Schema\\Types\\InterfaceType\\{closure}()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/src/Utils/InstrumentSchema.php", "line": 177, "function": "call_user_func()" }, { "call": "WPGraphQL\\Utils\\InstrumentSchema::WPGraphQL\\Utils\\{closure}()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/src/Utils/InstrumentSchema.php", "line": 177, "function": "call_user_func()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 624, "call": "WPGraphQL\\Utils\\InstrumentSchema::WPGraphQL\\Utils\\{closure}()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 550, "call": "GraphQL\\Executor\\ReferenceExecutor::resolveFieldValueOrError()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1196, "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1146, "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1107, "call": "GraphQL\\Executor\\ReferenceExecutor::collectAndExecuteSubfields()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 794, "call": "GraphQL\\Executor\\ReferenceExecutor::completeObjectValue()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 655, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 888, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValueCatchingError()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 762, "call": "GraphQL\\Executor\\ReferenceExecutor::completeListValue()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 655, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 557, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValueCatchingError()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1196, "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1146, "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1107, "call": "GraphQL\\Executor\\ReferenceExecutor::collectAndExecuteSubfields()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 794, "call": "GraphQL\\Executor\\ReferenceExecutor::completeObjectValue()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 652, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php", "line": 148, "call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php", "line": 53, "call": "GraphQL\\Executor\\Promise\\Adapter\\SyncPromise::GraphQL\\Executor\\Promise\\Adapter\\{closure}()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromiseAdapter.php", "line": 149, "call": "GraphQL\\Executor\\Promise\\Adapter\\SyncPromise::runQueue()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Server/Helper.php", "line": 214, "call": "GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter::wait()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Server/StandardServer.php", "line": 136, "call": "GraphQL\\Server\\Helper::executeOperation()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/src/Request.php", "line": 602, "call": "GraphQL\\Server\\StandardServer::executeRequest()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/src/Router.php", "line": 465, "call": "WPGraphQL\\Request::execute_http()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-content/plugins/wp-graphql/src/Router.php", "line": 270, "call": "WPGraphQL\\Router::process_http_request()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-includes/class-wp-hook.php", "line": 292, "call": "WPGraphQL\\Router::resolve_http_request()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-includes/class-wp-hook.php", "line": 316, "call": "WP_Hook::apply_filters()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-includes/plugin.php", "line": 551, "call": "WP_Hook::do_action()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-includes/class-wp.php", "line": 388, "function": "do_action_ref_array()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-includes/class-wp.php", "line": 750, "call": "WP::parse_request()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-includes/functions.php", "line": 1291, "call": "WP::main()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-blog-header.php", "line": 16, "function": "wp()" }, { "file": "/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/index.php", "line": 17, "function": "require('/home/585597.cloudwaysapps.com/xsfdcwbypr/public_html/wp-blog-header.php')" } ] } ], "data": { "pages": { "nodes": [ { "blocks": null, "title": "Homepage" } ] } }, "extensions": { "debug": [], "tracing": { "version": 1, "startTime": 1619567349.577913, "endTime": 1619567349.585405, "duration": 7492, "execution": { "resolvers": [ { "path": [ "pages" ], "parentType": "RootQuery", "fieldName": "pages", "returnType": "RootQueryToPageConnection", "startOffset": 1821, "duration": 798 }, { "path": [ "pages", "nodes" ], "parentType": "RootQueryToPageConnection", "fieldName": "nodes", "returnType": "[Page]", "startOffset": 4215, "duration": 10 }, { "path": [ "pages", "nodes", 0, "title" ], "parentType": "Page", "fieldName": "title", "returnType": "String", "startOffset": 7076, "duration": 282 } ] } } } }

sloyer commented 3 years ago

Im coming to the conclusion this is a setting in Cloudways hosting using a managed Digital ocean droplet. I fired up a new droplet on DO itself and it works.

sloyer commented 3 years ago

Also sorry, this should of been in the WPStarter repo

sloyer commented 3 years ago

Update to this - PHP Version 8.0 was the problem

It appears that the plugin requires several dependencies and one of them "ivome/graphql-relay-php" is not compatible with the current PHP version (8.0.3) and it requires a lower version

Switched to 7.4 and it works

ravewebdev commented 3 years ago

@sloyer Thanks for digging into this. We've also noticed issues with this plugin on PHP 8 so I've opened an issue on the plugin repo.