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

[5.x]: GraphQL - Setting unknown property: craft\elements\db\EntryQuery::volumeId #15341

Open
devinpitcher opened this issue Jul 12, 2024 · 5 comments
Labels

Comments

@devinpitcher
Copy link

What happened?

Description

I am in the process of migrating to Craft 5. We use Craft as a headless CMS and query everything over GraphQL. After migrating, we had to update all of our queries to use the new entry type names. During the process of migrating, I found a query that I cannot run and I get the following error:

{
  "errors": [
    {
      "debugMessage": "Setting unknown property: craft\\elements\\db\\EntryQuery::volumeId",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "trace": [
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php",
          "line": 601,
          "call": "yii\\base\\Component::__set('volumeId', array(2))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/elements/db/EntryQuery.php",
          "line": 290,
          "call": "craft\\elements\\db\\ElementQuery::__set('volumeId', array(2))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/yiisoft/yii2/BaseYii.php",
          "line": 557,
          "call": "craft\\elements\\db\\EntryQuery::__set('volumeId', array(2))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/services/Elements.php",
          "line": 3193,
          "call": "yii\\BaseYii::configure(instance of craft\\elements\\db\\EntryQuery, array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/services/Elements.php",
          "line": 3329,
          "call": "craft\\services\\Elements::_eagerLoadElementsInternal('craft\\elements\\Entry', array(1), array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/services/Elements.php",
          "line": 3329,
          "call": "craft\\services\\Elements::_eagerLoadElementsInternal('craft\\elements\\Entry', array(1), array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/services/Elements.php",
          "line": 3329,
          "call": "craft\\services\\Elements::_eagerLoadElementsInternal('benf\\neo\\elements\\Block', array(1), array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/services/Elements.php",
          "line": 3106,
          "call": "craft\\services\\Elements::_eagerLoadElementsInternal('craft\\elements\\Entry', array(1), array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php",
          "line": 1735,
          "call": "craft\\services\\Elements::eagerLoadElements('craft\\elements\\Entry', array(1), array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/elements/db/EntryQuery.php",
          "line": 1318,
          "call": "craft\\elements\\db\\ElementQuery::afterPopulate(array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php",
          "line": 1706,
          "call": "craft\\elements\\db\\EntryQuery::afterPopulate(array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php",
          "line": 1853,
          "call": "craft\\elements\\db\\ElementQuery::populate(array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/gql/base/ElementResolver.php",
          "line": 41,
          "call": "craft\\elements\\db\\ElementQuery::one()"
        },
        {
          "file": "/var/www/html/craftcms/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 623,
          "call": "craft\\gql\\base\\ElementResolver::resolveOne(null, array(1), array(2), instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/var/www/html/craftcms/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, 'craft\\gql\\resolvers\\elements\\Entry::resolveOne', null, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/var/www/html/craftcms/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": "/var/www/html/craftcms/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": "/var/www/html/craftcms/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/craftcms/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 156,
          "call": "GraphQL\\Executor\\ReferenceExecutor::doExecute()"
        },
        {
          "file": "/var/www/html/craftcms/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, 'Industry', null)"
        },
        {
          "file": "/var/www/html/craftcms/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 Industry($slug: [String]) {\n  entry(section: \"industries\", slug: $slug) {\n    ... on industries_modular_Entry {\n      title\n      moduleBuilder {\n        ... on moduleBuilder_moduleStatisticsblock_BlockType {\n          module: moduleStatisticsblock {\n            ... on moduleStatisticsblockBlock_Entry {\n              statisticBlocks {\n                ... on countUpStatistic_Entry {\n                  description\n                  customerLogo {\n                    slug\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n', null, array(2), null, 'Industry', null, array(26))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/services/Gql.php",
          "line": 525,
          "call": "GraphQL\\GraphQL::executeQuery(instance of GraphQL\\Type\\Schema, 'query Industry($slug: [String]) {\n  entry(section: \"industries\", slug: $slug) {\n    ... on industries_modular_Entry {\n      title\n      moduleBuilder {\n        ... on moduleBuilder_moduleStatisticsblock_BlockType {\n          module: moduleStatisticsblock {\n            ... on moduleStatisticsblockBlock_Entry {\n              statisticBlocks {\n                ... on countUpStatistic_Entry {\n                  description\n                  customerLogo {\n                    slug\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n', null, array(2), null, 'Industry', null, array(26))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/controllers/GraphqlController.php",
          "line": 194,
          "call": "craft\\services\\Gql::executeQuery(instance of craft\\models\\GqlSchema, 'query Industry($slug: [String]) {\n  entry(section: \"industries\", slug: $slug) {\n    ... on industries_modular_Entry {\n      title\n      moduleBuilder {\n        ... on moduleBuilder_moduleStatisticsblock_BlockType {\n          module: moduleStatisticsblock {\n            ... on moduleStatisticsblockBlock_Entry {\n              statisticBlocks {\n                ... on countUpStatistic_Entry {\n                  description\n                  customerLogo {\n                    slug\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n', null, 'Industry', true)"
        },
        {
          "call": "craft\\controllers\\GraphqlController::actionApi()"
        },
        {
          "file": "/var/www/html/craftcms/vendor/yiisoft/yii2/base/InlineAction.php",
          "line": 57,
          "function": "call_user_func_array(array(2), array(0))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/yiisoft/yii2/base/Controller.php",
          "line": 178,
          "call": "yii\\base\\InlineAction::runWithParams(array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/yiisoft/yii2/base/Module.php",
          "line": 552,
          "call": "yii\\base\\Controller::runAction('api', array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/web/Application.php",
          "line": 349,
          "call": "yii\\base\\Module::runAction('graphql/api', array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/web/Application.php",
          "line": 650,
          "call": "craft\\web\\Application::runAction('graphql/api', array(1))"
        },
        {
          "file": "/var/www/html/craftcms/vendor/craftcms/cms/src/web/Application.php",
          "line": 311,
          "call": "craft\\web\\Application::_processActionRequest(instance of craft\\web\\Request)"
        },
        {
          "file": "/var/www/html/craftcms/vendor/yiisoft/yii2/base/Application.php",
          "line": 384,
          "call": "craft\\web\\Application::handleRequest(instance of craft\\web\\Request)"
        },
        {
          "file": "/var/www/html/craftcms/web/index.php",
          "line": 13,
          "call": "yii\\base\\Application::run()"
        }
      ]
    }
  ],
  "data": {
    "entry": null
  }
}

Steps to reproduce

Here is the query:

query Industry($slug: [String]) {
  entry(section: "industries", slug: $slug) {
    ... on industries_modular_Entry {
      title
      moduleBuilder {
        ... on moduleBuilder_moduleStatisticsblock_BlockType {
          module: moduleStatisticsblock {
            ... on moduleStatisticsblockBlock_Entry {
              statisticBlocks {
                ... on countUpStatistic_Entry {
                  description
                  customerLogo {
                    ... on customer_Entry {
                      id
                      customerLogo {
                        url
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Here is the entry type:

fieldLayouts:
  a7f6800b-e774-403a-b113-fc3a8663e06c:
    tabs:
      -
        elementCondition: null
        elements:
          -
            dismissible: false
            elementCondition:
              class: craft\elements\conditions\entries\EntryCondition
              conditionRules:
                -
                  class: craft\elements\conditions\DateCreatedConditionRule
                  endDate: null
                  periodType: daysAgo
                  periodValue: null
                  rangeType: past7Days
                  startDate: null
                  uid: 3c34a1c5-413f-40a5-8e3b-bc83bd4dbf03
              elementType: craft\elements\Entry
              fieldContext: global
            style: warning
            tip: '**Wait!** Did you ensure we do not already have an entry for the customer you''re wanting to create?'
            type: craft\fieldlayoutelements\Tip
            uid: 818b4822-abc0-4bdc-ac95-4e070bf9c5fb
            userCondition: null
          -
            autocapitalize: true
            autocomplete: false
            autocorrect: true
            class: null
            disabled: false
            elementCondition: null
            id: null
            inputType: null
            instructions: null
            label: null
            max: null
            min: null
            name: null
            orientation: null
            placeholder: null
            readonly: false
            requirable: false
            size: null
            step: null
            tip: null
            title: null
            type: craft\fieldlayoutelements\entries\EntryTitleField
            uid: ed882032-c507-4989-95d4-05b255ebcf12
            userCondition: null
            warning: null
            width: 100
          -
            elementCondition: null
            fieldUid: 07f2db01-742b-4c45-87e8-c560b8c1a7ae # Industry Categories
            instructions: null
            label: Industries
            required: false
            tip: null
            type: craft\fieldlayoutelements\CustomField
            uid: 93039527-11f7-4cea-8e73-470d35f48502
            userCondition: null
            warning: null
            width: 100
          -
            elementCondition: null
            fieldUid: d5226d20-b3fa-429a-a046-e7b6b77a4cec # Team Categories
            instructions: null
            label: Teams
            required: false
            tip: null
            type: craft\fieldlayoutelements\CustomField
            uid: a67a5ba2-16d1-4396-9f68-34003d8fbbac
            userCondition: null
            warning: null
            width: 100
        name: Content
        uid: b7cf67b1-cb77-440a-8412-8ca19ff22653
        userCondition: null
      -
        elementCondition: null
        elements:
          -
            elementCondition: null
            fieldUid: 290cbcd1-1c36-4149-847c-1ebc0293329c # Customer Data
            instructions: null
            label: null
            required: false
            tip: null
            type: craft\fieldlayoutelements\CustomField
            uid: d3528917-3c33-4557-ae18-6b460364d8d4
            userCondition: null
            warning: null
            width: 100
          -
            elementCondition: null
            fieldUid: 2d667ed6-a3d6-45fc-839d-2dde08e6077b # Integrations
            instructions: 'Select the integrations this customer uses.'
            label: null
            required: false
            tip: null
            type: craft\fieldlayoutelements\CustomField
            uid: 3f34ecc2-ee4d-4cb5-abb2-19bdc11779e6
            userCondition: null
            warning: null
            width: 100
        name: Details
        uid: 08abe85c-9c45-41dc-8793-a116205846c9
        userCondition: null
      -
        elementCondition: null
        elements:
          -
            elementCondition: null
            heading: 'Full-Color Logo'
            type: craft\fieldlayoutelements\Heading
            uid: 23c6ba27-b708-4015-83dd-f46eb630721a
            userCondition: null
          -
            elementCondition: null
            fieldUid: 29b90dda-d7c4-43ba-9648-bac8ecafc50e # Customer Logo
            instructions: null
            label: __blank__
            required: false
            tip: null
            type: craft\fieldlayoutelements\CustomField
            uid: 2edc84ec-0920-469d-9a17-3100469def13
            userCondition: null
            warning: null
            width: 100
          -
            elementCondition: null
            heading: 'Monochrome Vector Logo'
            type: craft\fieldlayoutelements\Heading
            uid: f2cd395c-7012-4c2b-ab8c-0c3f5b6044ce
            userCondition: null
          -
            dismissible: false
            elementCondition: null
            style: warning
            tip: 'If you''re not entirely sure about this section, please ask the webdev team for help. These logos need to come from the design team.'
            type: craft\fieldlayoutelements\Tip
            uid: eeb6676f-7cb9-4115-8b2c-73117fb104ac
            userCondition: null
          -
            elementCondition: null
            fieldUid: 41b4b91d-3630-4812-980b-4ea12e007144 # Monochrome Customer Logo
            instructions: 'This needs to be a vector, all black logo.'
            label: __blank__
            required: false
            tip: null
            type: craft\fieldlayoutelements\CustomField
            uid: 8d116ea2-1fa1-473d-9247-f69268877e93
            userCondition: null
            warning: null
            width: 50
          -
            elementCondition: null
            fieldUid: 64c0db54-e14f-4e8d-8d17-9a6b3fef6d17 # Is Logo Taller
            instructions: 'There are two sizes for the vector logos. Is this one "taller" than the rest?'
            label: Taller
            required: false
            tip: null
            type: craft\fieldlayoutelements\CustomField
            uid: 4d45e5cb-e788-4605-a346-0d789dc12291
            userCondition: null
            warning: null
            width: 50
          -
            elementCondition: null
            heading: 'Landing Page Lockup Logo'
            type: craft\fieldlayoutelements\Heading
            uid: 52b79bd0-1305-47b6-ba99-4d76fdd1e6f9
            userCondition: null
          -
            elementCondition: null
            fieldUid: 26c766d7-85fa-4423-8cd2-1dc2f1c3cbf7 # Customer Logo - LP Lockup
            instructions: 'By default, landing pages that have a logo specified will use the "Full-Color" logo. If you''d like to show a different variation of the logo, you may upload or select one here. If this logo is going to be the same as the "Full-Color", you do not need to select or upload it twice here.'
            label: __blank__
            required: false
            tip: null
            type: craft\fieldlayoutelements\CustomField
            uid: 56ab8b0c-d9b1-446f-9cab-5a3a3e1e673f
            userCondition: null
            warning: null
            width: 100
        name: Logos
        uid: 71946b13-1cdb-442c-9781-0beadef27051
        userCondition: null
handle: customer
hasTitleField: true
name: Customer
showStatusField: true
slugTranslationKeyFormat: null
slugTranslationMethod: site
sortOrder: 1
titleFormat: null
titleTranslationKeyFormat: null
titleTranslationMethod: site

I suspect this field is part of the issue:

columnSuffix: null
handle: customerLogo
instructions: null
name: 'Customer Logo'
searchable: false
settings:
  allowSelfRelations: false
  allowSubfolders: false
  allowUploads: true
  allowedKinds:
    - image
  branchLimit: null
  defaultUploadLocationSource: 'volume:d63308cc-fed3-41db-a03f-f26fb92e6467' # Assets
  defaultUploadLocationSubpath: null
  localizeRelations: false
  maintainHierarchy: false
  maxRelations: 1
  minRelations: null
  previewMode: full
  restrictFiles: true
  restrictLocation: true
  restrictedDefaultUploadSubpath: null
  restrictedLocationSource: 'volume:d63308cc-fed3-41db-a03f-f26fb92e6467' # Assets
  restrictedLocationSubpath: 'customers/{slug}'
  selectionLabel: null
  showCardsInGrid: false
  showSiteMenu: true
  showUnpermittedFiles: false
  showUnpermittedVolumes: false
  sources: '*'
  targetSiteId: null
  validateRelatedElements: false
  viewMode: large
translationKeyFormat: null
translationMethod: site
type: craft\fields\Assets

Expected behavior

The query should return an asset.

{
  "data": {
    "entry": {
      "title": "Travel",
      "moduleBuilder": [
        {
          "module": [
            {
              "statisticBlocks": [
                {
                  "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus aliquam condimentum ex quis sollicitudin.",
                  "customerLogo": [
                    {
                      "id": "172023",
                      "customerLogo": [
                        {
                          "url": "url"
                        }
                      ]
                    }
                  ]
                },
                {
                  "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus aliquam condimentum ex quis sollicitudin.",
                  "customerLogo": [
                    {
                      "id": "6960",
                      "customerLogo": [
                        {
                          "url": "url"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  }
}

Actual behavior

The query throws the Setting unknown property: craft\elements\db\EntryQuery::volumeId error.

Craft CMS version

Craft Pro 5.2.6

PHP version

8.2.20

Operating system and version

Linux 6.1.29-0-virt

Database type and version

PostgreSQL 13.11

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

  • Amazon S3 2.2.1
  • Bugsnag 5.0.0
  • Colour Swatches 5.0.0
  • Control Panel CSS 3.0.0
  • Control Panel JS 3.0.0
  • CP Field Inspect 2.0.1
  • Expanded Singles 3.0.0
  • Field Manager 4.0.1
  • Hyper 2.0.2
  • Navigation 3.0.2
  • Neo 5.0.5
  • Redactor 4.1.0
  • Redirects 5.0.2
  • SEO 5.0.4
  • Super Table 4.0.1
  • Vizy 3.0.0
@brandonkelly
Copy link
Member

It looks like moduleBuilder is a Neo field. Can you try reproducing with Matrix instead?

@Tam
Copy link

Tam commented Jul 24, 2024

We're getting the same issue using Matrix. I've managed to narrow it down to a specific Entry field in a Matrix block. We have other Entry fields in other Matrix blocks that are loading without issue, but it's worth noting that the fields that's erroring is linked to an entry with an Asset field at the top-level of the entry (others have asset fields as children of matrix blocks).

It doesn't seem to matter what fields we query in the affected entry field, it still errors. The only way to stop the error is to either unlink the entry or not query the entry field at all.

A basic entry layout would be: Entry -> Matrix Field -> Block with Entries field ->> links to ->> Entry with Asset field

We're also in the process of migrating this existing site to Craft 5.

Craft Pro 5.1.4
MySQL 8.1.0
PHP 8.2.21

Plugins:

  • Asset Usage 4.0.0
  • CKEditor 4.0.6
  • DigitalOcean Spaces Filesystem 3.0.0-beta.1
  • Feed Me 6.0.1
  • Formie 3.0.0-beta.16
  • Hyper 2.0.0
  • Navigation 3.0.0
  • Retour 5.0.0
  • Sentry Logger 5.0.1
  • SEO v5.0.0-rc2
  • Super Table 4.0.0
  • Utility Belt 5.0.0-beta.0

@brandonkelly
Copy link
Member

@Tam Any chance you can send a database backup and your Composer files over to [email protected]?

@tommysvr
Copy link

tommysvr commented Sep 5, 2024

I haven't been able to reliably reproduce on a fresh install yet, but the solution to @Tam's issue was removing the field handle override on that entry type.

@brandonkelly
Copy link
Member

Huh, maybe related to #15623.

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

No branches or pull requests

4 participants