Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphiql-ide page not loading after activating the plugin #10

Open
davidmadon opened this issue Oct 26, 2022 · 12 comments
Open

Graphiql-ide page not loading after activating the plugin #10

davidmadon opened this issue Oct 26, 2022 · 12 comments

Comments

@davidmadon
Copy link

davidmadon commented Oct 26, 2022

Hi,

I'm running into a JS console error when trying to load the Graphiql-ide page in WP-admin after activating your plugin.

SCR-20221026-j8m

Requests to the API still seem to work properly.

Wordpress: Version 6.1 - RC3
Advanced Custom Fields PRO: Version 6.0.3
WP GraphQL: Version 1.12.0
WPGraphQL for Advanced Custom Fields: Version 0.6.1
WPGraphQL ACF Mutations: Version 1.1.1

@zngly-vlad
Copy link
Contributor

Hello,

Have a look at the network tab as well and see if there is any more information on the error.

Could you provide more information on the acf fields you are using. I don't think I support all of them yet.

Thanks

@davidmadon
Copy link
Author

Sure!

This is the response I'm getting in the network request on that page:

{
  "errors": [
    {
      "debugMessage": "GraphQL\\Type\\Schema::resolveType(): Return value must be of type GraphQL\\Type\\Definition\\Type, null returned",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 15,
          "column": 5
        }
      ],
      "path": [
        "__schema",
        "types"
      ],
      "trace": [
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Type/Definition/InputObjectField.php",
          "line": 121,
          "call": "GraphQL\\Type\\Schema::resolveType(instance of Closure)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Utils/TypeInfo.php",
          "line": 218,
          "call": "GraphQL\\Type\\Definition\\InputObjectField::getType()"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Utils/TypeInfo.php",
          "line": 162,
          "call": "GraphQL\\Utils\\TypeInfo::extractTypes(GraphQLType: CreateEventInput, array(307))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Utils/TypeInfo.php",
          "line": 222,
          "call": "GraphQL\\Utils\\TypeInfo::extractTypes(GraphQLType: CreateEventInput, array(306))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Type/Schema.php",
          "line": 222,
          "call": "GraphQL\\Utils\\TypeInfo::extractTypes(GraphQLType: RootMutation, array(306))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Type/Schema.php",
          "line": 208,
          "call": "GraphQL\\Type\\Schema::collectAllTypes()"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Type/Introspection.php",
          "line": 240,
          "call": "GraphQL\\Type\\Schema::getTypeMap()"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 623,
          "call": "GraphQL\\Type\\Introspection::GraphQL\\Type\\{closure}(instance of WPGraphQL\\WPSchema, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 550,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveFieldValueOrError(instance of GraphQL\\Type\\Definition\\FieldDefinition, instance of GraphQL\\Language\\AST\\FieldNode, instance of Closure, instance of WPGraphQL\\WPSchema, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1195,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: __Schema, instance of WPGraphQL\\WPSchema, instance of ArrayObject(1), array(2))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1145,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: __Schema, instance of WPGraphQL\\WPSchema, array(1), instance of ArrayObject(6))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1106,
          "call": "GraphQL\\Executor\\ReferenceExecutor::collectAndExecuteSubfields(GraphQLType: __Schema, instance of ArrayObject(1), array(1), instance of WPGraphQL\\WPSchema)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 793,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeObjectValue(GraphQLType: __Schema, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of WPGraphQL\\WPSchema)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 741,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: __Schema, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of WPGraphQL\\WPSchema)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 654,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: __Schema, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of WPGraphQL\\WPSchema)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 557,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValueCatchingError(GraphQLType: __Schema, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of WPGraphQL\\WPSchema)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1195,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: RootQuery, null, instance of ArrayObject(1), array(1))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 264,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: RootQuery, null, array(0), instance of ArrayObject(1))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 215,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeOperation(instance of GraphQL\\Language\\AST\\OperationDefinitionNode, null)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 156,
          "call": "GraphQL\\Executor\\ReferenceExecutor::doExecute()"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/GraphQL.php",
          "line": 162,
          "call": "GraphQL\\Executor\\Executor::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of WPGraphQL\\WPSchema, instance of GraphQL\\Language\\AST\\DocumentNode, null, instance of WPGraphQL\\AppContext, array(0), 'IntrospectionQuery', null)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Server/Helper.php",
          "line": 311,
          "call": "GraphQL\\GraphQL::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of WPGraphQL\\WPSchema, instance of GraphQL\\Language\\AST\\DocumentNode, null, instance of WPGraphQL\\AppContext, array(0), 'IntrospectionQuery', null, array(29))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Server/Helper.php",
          "line": 211,
          "call": "GraphQL\\Server\\Helper::promiseToExecuteOperation(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Server\\ServerConfig, instance of GraphQL\\Server\\OperationParams)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Server/StandardServer.php",
          "line": 136,
          "call": "GraphQL\\Server\\Helper::executeOperation(instance of GraphQL\\Server\\ServerConfig, instance of GraphQL\\Server\\OperationParams)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/Request.php",
          "line": 713,
          "call": "GraphQL\\Server\\StandardServer::executeRequest(instance of GraphQL\\Server\\OperationParams)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/Router.php",
          "line": 480,
          "call": "WPGraphQL\\Request::execute_http()"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/Router.php",
          "line": 274,
          "call": "WPGraphQL\\Router::process_http_request()"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp-hook.php",
          "line": 308,
          "call": "WPGraphQL\\Router::resolve_http_request(instance of WP)"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp-hook.php",
          "line": 332,
          "call": "WP_Hook::apply_filters(null, array(1))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/plugin.php",
          "line": 565,
          "call": "WP_Hook::do_action(array(1))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp.php",
          "line": 399,
          "function": "do_action_ref_array('parse_request', array(1))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp.php",
          "line": 780,
          "call": "WP::parse_request((empty string))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/functions.php",
          "line": 1332,
          "call": "WP::main((empty string))"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/wp-blog-header.php",
          "line": 16,
          "function": "wp()"
        },
        {
          "file": "/Users/soulstream/Local Sites/united-soul/app/public/index.php",
          "line": 17,
          "function": "require('/Users/soulstream/Local Sites/united-soul/app/public/wp-blog-header.php')"
        }
      ]
    }
  ],
  "extensions": {
    "debug": [
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'Template_Portalpage' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "Template_Portalpage",
        "stack": [
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/Registry/TypeRegistry.php:624",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/access-functions.php:184",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp-hook.php:308",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp-hook.php:332",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/plugin.php:517",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/Registry/TypeRegistry.php:530",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp-hook.php:308",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp-hook.php:332",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/plugin.php:517",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/Registry/TypeRegistry.php:232",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/Registry/SchemaRegistry.php:38",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/WPGraphQL.php:795",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/Request.php:157",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/Router.php:464",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-content/plugins/wp-graphql/src/Router.php:274",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp-hook.php:308",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp-hook.php:332",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/plugin.php:565",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp.php:399",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/class-wp.php:780",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-includes/functions.php:1332",
          "/Users/soulstream/Local Sites/united-soul/app/public/wp-blog-header.php:16",
          "/Users/soulstream/Local Sites/united-soul/app/public/index.php:17"
        ]
      }
    ],
    "tracing": {
      "version": 1,
      "startTime": 1666785890.089034,
      "endTime": 1666785890.320435,
      "duration": 231400,
      "execution": {
        "resolvers": []
      }
    },
    "queryLog": [
      "Query Logging has been disabled. The 'SAVEQUERIES' Constant is set to 'false' on your server."
    ],
    "queryAnalyzer": {
      "keys": "4635c4880d71342bbfbebde99495c79f graphql:Query",
      "keysLength": 46,
      "keysCount": 2,
      "skippedKeys": "",
      "skippedKeysSize": 0,
      "skippedKeysCount": 0,
      "skippedTypes": []
    }
  }
}

This is with debug activate in the GraphQL plugin. I'm pretty sure the DUPLICATE_TYPE warning in the end is unrelated. It was there before adding your plugin.

@davidmadon
Copy link
Author

It's throwing JS errors in the ACF admin page when editing a field group as well:

SCR-20221026-kbb

@davidmadon
Copy link
Author

davidmadon commented Oct 26, 2022

Will try to activate the plugin in a test install without any fields and see if that makes a differens.

@davidmadon
Copy link
Author

It works in my test install with 1 active text field so it's probably related to unsupported field types like you mention. Will add a few more to figure out which one it is.

@davidmadon
Copy link
Author

Error gets triggered when I add the "Post Object" field type.

@davidmadon
Copy link
Author

Upon closer inspection it's a slightly different error message:

SCR-20221026-l8t

@davidmadon
Copy link
Author

It seems to be 2 issues:

The first error message "Internal server error" seem to be related to the Google maps field. Adding that breaks both the Graphiql IDE and the ACF field group edit page.
(Will hold of using this field for now :)

The last message regarding the "PostObjectUnion" is when a Post Object field typ is set to return the whole Post Object. But it works if you set the return to "Post ID".

@zngly-vlad
Copy link
Contributor

Yes, I use post ID internally, never tried it with postObject.
I havent tried the google maps field before.

The Ide could do with better debugging support :)

Will look into fixing this when i get a chance. Thank you for pointing this out

@davidmadon
Copy link
Author

Sure, no issue.

Thanks for building the plugin!

I might look into adding support for the Google Maps field myself, might need it later on in the project I'm working on. But for now some text fields will do just fine for the address :)

Side note: One thing I noticed when adding test fields is that if you save a field with empty "name" field it breaks the Graphiql IDE as well, which makes kind of sense. But it only happens with your plugin active so it seems the WPGraphQL for Advanced Custom Fields have some failsafe for this.

@davidmadon
Copy link
Author

Any pointers on adding more field types to your plugin?
Might be able to contribute

@zngly-vlad
Copy link
Contributor

As to where in the code start here: https://github.com/zngly/wp-graphql-acf-mutations/blob/main/src/config.php#L371

I suggest forking the repo and submitting a pr.

This plugin is mainly used internally at Zngly. I am happy to expand the collaboration to whomever wishes to contribute 😄. If you have any tips on any improvements feel free to message me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants