Closed benfeather closed 1 month ago
I'm using Formie for a registration form, so I have created an integration like this:
I then enabled the "Unique Value" option for my email field:
But when I submit the form via GraphQL, it throws an error:
{ "errors": [ { "debugMessage": "Undefined array key 0", "message": "Internal server error", "extensions": { "category": "internal" }, "file": "/var/www/html/vendor/yiisoft/yii2/db/conditions/SimpleCondition.php", "line": 82, "trace": [ { "file": "/var/www/html/vendor/craftcms/cms/src/web/ErrorHandler.php", "line": 79, "call": "yii\\base\\ErrorHandler::handleError(2, 'Undefined array key 0', '/var/www/html/vendor/yiisoft/yii2/db/conditions/SimpleCondition.php', 82)" }, { "file": "/var/www/html/vendor/yiisoft/yii2/db/conditions/SimpleCondition.php", "line": 82, "call": "craft\\web\\ErrorHandler::handleError(2, 'Undefined array key 0', '/var/www/html/vendor/yiisoft/yii2/db/conditions/SimpleCondition.php', 82)" }, { "file": "/var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php", "line": 1606, "call": "yii\\db\\conditions\\SimpleCondition::fromArrayDefinition('JSON_CONTAINS(S.CONTENT, \\'{\\\"0BEE1286-8418-41CE-8384-250DA2A29FCA\\\":\\\"CONTACT@BENFEATHER.DEV\\\"}\\')', array(2))" }, { "file": "/var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php", "line": 1576, "call": "yii\\db\\QueryBuilder::createConditionFromArray(array(2))" }, { "file": "/var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php", "line": 1357, "call": "yii\\db\\QueryBuilder::buildCondition(array(3), array(0))" }, { "file": "/var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php", "line": 235, "call": "yii\\db\\QueryBuilder::buildWhere(array(3), array(0))" }, { "file": "/var/www/html/vendor/yiisoft/yii2/db/Query.php", "line": 157, "call": "yii\\db\\QueryBuilder::build(instance of craft\\db\\Query)" }, { "file": "/var/www/html/vendor/yiisoft/yii2/db/Query.php", "line": 442, "call": "yii\\db\\Query::createCommand(instance of craft\\db\\Connection)" }, { "file": "/var/www/html/vendor/craftcms/cms/src/db/Query.php", "line": 321, "call": "yii\\db\\Query::exists(null)" }, { "file": "/var/www/html/vendor/verbb/formie/src/base/Field.php", "line": 571, "call": "craft\\db\\Query::exists()" }, { "file": "/var/www/html/vendor/craftcms/cms/src/base/Element.php", "line": 2724, "call": "verbb\\formie\\base\\Field::validateUniqueValue(instance of verbb\\formie\\elements\\Submission, null)" }, { "file": "/var/www/html/vendor/yiisoft/yii2/validators/InlineValidator.php", "line": 77, "call": "craft\\base\\Element::validateCustomFieldAttribute('field:email', array(3), instance of yii\\validators\\InlineValidator, 'contact@benfeather.dev')" }, { "file": "/var/www/html/vendor/yiisoft/yii2/validators/Validator.php", "line": 260, "call": "yii\\validators\\InlineValidator::validateAttribute(instance of verbb\\formie\\elements\\Submission, 'field:email')" }, { "file": "/var/www/html/vendor/verbb/formie/src/elements/Submission.php", "line": 1217, "call": "yii\\validators\\Validator::validateAttributes(instance of verbb\\formie\\elements\\Submission)" }, { "file": "/var/www/html/vendor/yiisoft/yii2/base/Model.php", "line": 370, "call": "verbb\\formie\\elements\\Submission::afterValidate()" }, { "file": "/var/www/html/vendor/craftcms/cms/src/base/Element.php", "line": 2588, "call": "yii\\base\\Model::validate(array(12), true)" }, { "file": "/var/www/html/vendor/verbb/formie/src/elements/Submission.php", "line": 509, "call": "craft\\base\\Element::validate(null, true)" }, { "file": "/var/www/html/vendor/verbb/formie/src/gql/resolvers/mutations/SubmissionResolver.php", "line": 121, "call": "verbb\\formie\\elements\\Submission::validate()" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 623, "call": "verbb\\formie\\gql\\resolvers\\mutations\\SubmissionResolver::saveSubmission(null, array(7), array(2), instance of GraphQL\\Type\\Definition\\ResolveInfo)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 549, "call": "GraphQL\\Executor\\ReferenceExecutor::resolveFieldValueOrError(instance of GraphQL\\Type\\Definition\\FieldDefinition, instance of GraphQL\\Language\\AST\\FieldNode, array(2), null, instance of GraphQL\\Type\\Definition\\ResolveInfo)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 474, "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: Mutation, null, instance of ArrayObject(1), array(1))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 857, "call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(array(0), 'save_register_Submission')" }, { "call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(array(0), 'save_register_Submission')" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 847, "function": "array_reduce(array(1), instance of Closure, array(0))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 468, "call": "GraphQL\\Executor\\ReferenceExecutor::promiseReduce(array(1), instance of Closure, array(0))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 263, "call": "GraphQL\\Executor\\ReferenceExecutor::executeFieldsSerially(GraphQLType: Mutation, null, array(0), instance of ArrayObject(1))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 215, "call": "GraphQL\\Executor\\ReferenceExecutor::executeOperation(instance of GraphQL\\Language\\AST\\OperationDefinitionNode, null)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/Executor.php", "line": 156, "call": "GraphQL\\Executor\\ReferenceExecutor::doExecute()" }, { "file": "/var/www/html/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), array(7), 'FormMutation', null)" }, { "file": "/var/www/html/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, 'mutation FormMutation($recaptchaCaptcha: FormieCaptchaInput, $name1: String, $phone: String, $email: String, $password: String, $repeatPassword: String, $termsAndConditions: String) {\n save_register_Submission(\n name1: $name1\n phone: $phone\n email: $email\n password: $password\n repeatPassword: $repeatPassword\n termsAndConditions: $termsAndConditions\n recaptchaCaptcha: $recaptchaCaptcha\n ) {\n id\n }\n}\n', null, array(2), array(7), 'FormMutation', null, array(26))" }, { "file": "/var/www/html/vendor/craftcms/cms/src/services/Gql.php", "line": 510, "call": "GraphQL\\GraphQL::executeQuery(instance of GraphQL\\Type\\Schema, 'mutation FormMutation($recaptchaCaptcha: FormieCaptchaInput, $name1: String, $phone: String, $email: String, $password: String, $repeatPassword: String, $termsAndConditions: String) {\n save_register_Submission(\n name1: $name1\n phone: $phone\n email: $email\n password: $password\n repeatPassword: $repeatPassword\n termsAndConditions: $termsAndConditions\n recaptchaCaptcha: $recaptchaCaptcha\n ) {\n id\n }\n}\n', null, array(2), array(7), 'FormMutation', null, array(26))" }, { "file": "/var/www/html/vendor/craftcms/cms/src/controllers/GraphqlController.php", "line": 194, "call": "craft\\services\\Gql::executeQuery(instance of craft\\models\\GqlSchema, 'mutation FormMutation($recaptchaCaptcha: FormieCaptchaInput, $name1: String, $phone: String, $email: String, $password: String, $repeatPassword: String, $termsAndConditions: String) {\n save_register_Submission(\n name1: $name1\n phone: $phone\n email: $email\n password: $password\n repeatPassword: $repeatPassword\n termsAndConditions: $termsAndConditions\n recaptchaCaptcha: $recaptchaCaptcha\n ) {\n id\n }\n}\n', array(7), 'FormMutation', true)" }, { "call": "craft\\controllers\\GraphqlController::actionApi()" }, { "file": "/var/www/html/vendor/yiisoft/yii2/base/InlineAction.php", "line": 57, "function": "call_user_func_array(array(2), array(0))" }, { "file": "/var/www/html/vendor/yiisoft/yii2/base/Controller.php", "line": 178, "call": "yii\\base\\InlineAction::runWithParams(array(2))" }, { "file": "/var/www/html/vendor/yiisoft/yii2/base/Module.php", "line": 552, "call": "yii\\base\\Controller::runAction('api', array(2))" }, { "file": "/var/www/html/vendor/craftcms/cms/src/web/Application.php", "line": 349, "call": "yii\\base\\Module::runAction('graphql/api', array(2))" }, { "file": "/var/www/html/vendor/craftcms/cms/src/web/Application.php", "line": 650, "call": "craft\\web\\Application::runAction('graphql/api', array(2))" }, { "file": "/var/www/html/vendor/craftcms/cms/src/web/Application.php", "line": 311, "call": "craft\\web\\Application::_processActionRequest(instance of craft\\web\\Request)" }, { "file": "/var/www/html/vendor/yiisoft/yii2/base/Application.php", "line": 384, "call": "craft\\web\\Application::handleRequest(instance of craft\\web\\Request)" }, { "file": "/var/www/html/web/index.php", "line": 12, "call": "yii\\base\\Application::run()" } ] } ], "data": { "save_register_Submission": null } }
N/A
5.1.1
dev-craft-5 as 3.0.0-beta.9
Yes
No response
Fixed for the next release. To get this early, run composer require verbb/formie:"dev-craft-5 as 3.0.0-beta.9".
composer require verbb/formie:"dev-craft-5 as 3.0.0-beta.9"
Updated in 3.0.0-beta.10
Describe the bug
I'm using Formie for a registration form, so I have created an integration like this:
I then enabled the "Unique Value" option for my email field:
But when I submit the form via GraphQL, it throws an error:
Steps to reproduce
N/A
Form settings
Craft CMS version
5.1.1
Plugin version
dev-craft-5 as 3.0.0-beta.9
Multi-site?
Yes
Additional context
No response