verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
93 stars 69 forks source link

Graphql PageSettingsInterface errors out #1845

Closed sir-savien closed 2 months ago

sir-savien commented 2 months ago

Describe the bug

Any graphql query to the page settings (for example to get the submit button label) throws an internal error.

Steps to reproduce

  1. Minimal reproduction query:

    query form($id: [String]) {
    form: formieForm(handle: $id) {
    submissionMutationName
    pages {
      ... on PageType {
        settings {
          submitButtonLabel
        }
      }
    }
    }
    }
  2. Use query on a formie form with a single-line text field

  3. See the error on output, example given below

Error output

{
  "errors": [
    {
      "debugMessage": "verbb\\formie\\gql\\interfaces\\PageSettingsInterface::verbb\\formie\\gql\\interfaces\\{closure}(): Argument #1 ($value) must be of type verbb\\formie\\models\\FieldLayoutPageSettings, array given, called in /Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Type/Definition/InterfaceType.php on line 130",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/verbb/formie/src/gql/interfaces/PageSettingsInterface.php",
      "line": 37,
      "trace": [
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Type/Definition/InterfaceType.php",
          "line": 130,
          "call": "verbb\\formie\\gql\\interfaces\\PageSettingsInterface::verbb\\formie\\gql\\interfaces\\{closure}(array(16), array(2), instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 940,
          "call": "GraphQL\\Type\\Definition\\InterfaceType::resolveType(array(16), array(2), instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 789,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeAbstractValue(GraphQLType: PageSettingsInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(4), array(16))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 654,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: PageSettingsInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(4), array(16))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 556,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValueCatchingError(GraphQLType: PageSettingsInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(4), array(16))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1195,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: PageType, instance of verbb\\formie\\models\\FieldLayoutPage, instance of ArrayObject(1), array(4))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1145,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: PageType, instance of verbb\\formie\\models\\FieldLayoutPage, array(3), instance of ArrayObject(1))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1105,
          "call": "GraphQL\\Executor\\ReferenceExecutor::collectAndExecuteSubfields(GraphQLType: PageType, instance of ArrayObject(1), array(3), instance of verbb\\formie\\models\\FieldLayoutPage)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 973,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeObjectValue(GraphQLType: PageType, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(3), instance of verbb\\formie\\models\\FieldLayoutPage)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 789,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeAbstractValue(GraphQLType: PageInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(3), instance of verbb\\formie\\models\\FieldLayoutPage)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 654,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: PageInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(3), instance of verbb\\formie\\models\\FieldLayoutPage)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 887,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValueCatchingError(GraphQLType: PageInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(3), instance of verbb\\formie\\models\\FieldLayoutPage)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 761,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeListValue(GraphQLType: PageInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(2), array(1))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 654,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: PageInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(2), array(1))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 556,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValueCatchingError(GraphQLType: PageInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(2), array(1))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1195,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: infoForm_Form, instance of verbb\\formie\\elements\\Form, instance of ArrayObject(1), array(2))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1145,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: infoForm_Form, instance of verbb\\formie\\elements\\Form, array(1), instance of ArrayObject(2))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1105,
          "call": "GraphQL\\Executor\\ReferenceExecutor::collectAndExecuteSubfields(GraphQLType: infoForm_Form, instance of ArrayObject(1), array(1), instance of verbb\\formie\\elements\\Form)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 973,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeObjectValue(GraphQLType: infoForm_Form, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of verbb\\formie\\elements\\Form)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 789,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeAbstractValue(GraphQLType: FormInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of verbb\\formie\\elements\\Form)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 654,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: FormInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of verbb\\formie\\elements\\Form)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 556,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValueCatchingError(GraphQLType: FormInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of verbb\\formie\\elements\\Form)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1195,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: Query, null, instance of ArrayObject(1), array(1))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 264,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: Query, null, array(0), instance of ArrayObject(1))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 215,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeOperation(instance of GraphQL\\Language\\AST\\OperationDefinitionNode, null)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 156,
          "call": "GraphQL\\Executor\\ReferenceExecutor::doExecute()"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/GraphQL.php",
          "line": 161,
          "call": "GraphQL\\Executor\\Executor::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, instance of GraphQL\\Language\\AST\\DocumentNode, null, array(2), null, 'form', null)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/webonyx/graphql-php/src/GraphQL.php",
          "line": 93,
          "call": "GraphQL\\GraphQL::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, 'query form($id: [String]) {\n  form: formieForm(handle: $id) {\n    submissionMutationName\n    pages {\n      ... on PageType {\n        settings {\n          submitButtonLabel\n        }\n      }\n    }\n  }\n}\n', null, array(2), null, 'form', null, array(26))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/craftcms/cms/src/services/Gql.php",
          "line": 510,
          "call": "GraphQL\\GraphQL::executeQuery(instance of GraphQL\\Type\\Schema, 'query form($id: [String]) {\n  form: formieForm(handle: $id) {\n    submissionMutationName\n    pages {\n      ... on PageType {\n        settings {\n          submitButtonLabel\n        }\n      }\n    }\n  }\n}\n', null, array(2), null, 'form', null, array(26))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/craftcms/cms/src/controllers/GraphqlController.php",
          "line": 194,
          "call": "craft\\services\\Gql::executeQuery(instance of craft\\models\\GqlSchema, 'query form($id: [String]) {\n  form: formieForm(handle: $id) {\n    submissionMutationName\n    pages {\n      ... on PageType {\n        settings {\n          submitButtonLabel\n        }\n      }\n    }\n  }\n}\n', null, 'form', true)"
        },
        {
          "call": "craft\\controllers\\GraphqlController::actionApi()"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/yiisoft/yii2/base/InlineAction.php",
          "line": 57,
          "function": "call_user_func_array(array(2), array(0))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/yiisoft/yii2/base/Controller.php",
          "line": 178,
          "call": "yii\\base\\InlineAction::runWithParams(array(2))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/yiisoft/yii2/base/Module.php",
          "line": 552,
          "call": "yii\\base\\Controller::runAction('api', array(2))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/craftcms/cms/src/web/Application.php",
          "line": 349,
          "call": "yii\\base\\Module::runAction('graphql/api', array(2))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/craftcms/cms/src/web/Application.php",
          "line": 650,
          "call": "craft\\web\\Application::runAction('graphql/api', array(2))"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/craftcms/cms/src/web/Application.php",
          "line": 311,
          "call": "craft\\web\\Application::_processActionRequest(instance of craft\\web\\Request)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/vendor/yiisoft/yii2/base/Application.php",
          "line": 384,
          "call": "craft\\web\\Application::handleRequest(instance of craft\\web\\Request)"
        },
        {
          "file": "/Users/eliamenin/repos/php/lanordica-be/web/index.php",
          "line": 12,
          "call": "yii\\base\\Application::run()"
        }
      ]
    }
  ],
  "data": {
    "form": {
      "submissionMutationName": "save_infoForm_Submission",
      "pages": [
        {
          "settings": null
        }
      ]
    }
  }
}

Form settings

Craft CMS version

5.0.5

Plugin version

3.0.0-beta.8

Multi-site?

Yes

Additional context

This was replicated also with a fresh install of craftcms

engram-design commented 2 months ago

Fixed for the next release. To get this early, run composer require verbb/formie:"dev-craft-5 as 3.0.0-beta.8".

sir-savien commented 2 months ago

Thank you very much for the quick fix!