0

Given this mutation (which adds rows to a table)

mutation {
  save_thesection_thetype_Entry (
                        siteId: 1,
                        title: "test titel",
                        slug: "test-press",
                        mndLinks: [{ col1: "test", col2: "uirl"}]
            ) {
    id
  }
}

Is working fine on the first entrytype and section I used it on. When trying to use the exact same field (mndLinks) on a different section and type, I get the error:

Field \"save_thesection_thetype_Entry\" argument \"mndLinks\" requires type mndLinks_TableRowInput, found [{col1: \"test\", col2: \"uirl\"}].

Not sure why it expects a table to not be an array of mndLinks_TableRowInput in this case, but it is for the working entry type? Figured it might be a bug, but upgraded to the latest version and still the same thing.

ABut also, if I do change the data to not be an array, it throws an underlying error:

{
  "errors": [
    {
      "debugMessage": "array_key_exists() expects parameter 2 to be array, string given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "file": "/app/vendor/craftcms/cms/src/fields/Table.php",
      "line": 389,
      "trace": [
        {
          "file": "/app/vendor/craftcms/cms/src/web/ErrorHandler.php",
          "line": 84,
          "call": "yii\\base\\ErrorHandler::handleError(2, 'array_key_exists() expects parameter 2 to be array, string given', '/app/vendor/craftcms/cms/src/fields/Table.php', 389)"
        },
        {
          "call": "craft\\web\\ErrorHandler::handleError(2, 'array_key_exists() expects parameter 2 to be array, string given', '/app/vendor/craftcms/cms/src/fields/Table.php', 389, array(5))"
        },
        {
          "file": "/app/vendor/craftcms/cms/src/fields/Table.php",
          "line": 389,
          "function": "array_key_exists('col1', 'test')"
        },

Which tells me that it is the graphQL schema that is wrong, but I have no idea on how to fix it...?

EDIT: I just noticed, that if I remove this field from the first EntryType, the schema becomes correct. As soon as I re-add it, the same error appears. Must surely be a bug.

Edit2: Was a bug: https://github.com/craftcms/cms/issues/10173

1
  • 1
    Going to go ahead and vote to close this as a bug. Thanks for the follow-through!
    – Brad Bell
    Nov 29 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.