Cms: GraphQL returns empty asset

Created on 16 Sep 2020  路  5Comments  路  Source: craftcms/cms

Description

With Craft 3.5.9, everything was working fine, but after updating to 3.5.10.1, some GraphQL queries were returning empty assets array.
Here is the query:

{
  entry(section: "home") {
    title
    ... on home_home_Entry {
      blocks {
        ... on blocks_bannerCarousel_BlockType {
          children {
            ... on blocks_banner_BlockType {
              background {
                ... on background_image_BlockType {
                  id
                  image {
                    id
                    url
                    width
                    height
                    ... on amazonS3_Asset {
                      title: altText
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Here is the result before with Craft 3.5.9:

{
  "data": {
    "entry": {
      "title": "Home",
      "blocks": [
        {
          "children": [
            {
              "background": [
                {
                  "id": "147157",
                  "image": [
                    {
                      "id": "331826",
                      "url": "https://assets.example.org/some-image-3840x1800.jpg",
                      "width": 3840,
                      "height": 1800,
                      "title": "Some title",
                      "animated": false,
                      "animatedIconFallback": []
                    }
                  ]
                }
...

And after with Craft 3.5.10.1:

{
  "data": {
    "entry": {
      "title": "Home",
      "blocks": [
        {
          "children": [
            {
              "background": [
                {
                  "id": "147157",
                  "image": []
                }

The blocks field (with banner carousel and banner child) is a Neo field, the background field is a Matrix field and the image is an Amazon S3 field.

Additional info

  • Craft version: 3.5.10.1
  • PHP version: 7.3.18
  • Database driver & version: PostgreSQL 12.4
  • Plugins & versions:
    Amazon S3 | 1.2.11
    Neo | 2.8.8
    Super Table | 2.6.2
bug

All 5 comments

At a glance, it's hard to tell, because there _were_ some changes introduced (or rather - wrinkles straightened out) in GQL resolving logic.

Is it possible for you to send over a DB backup, composer.json, and composer.lock files to [email protected] and reference this issue?

I sent you the DB, composer.json and composer.lock.
Maybe related, but with an asset field inside a matrix inside a super table, it also returns an empty array:

{
  entry(id: 417146) {
    id
    ... on blogPost_blogPost_Entry {
      blogPromotions {
        ... on blogPromotions_BlockType {
          promotions {
            ... on promotions_promotionEntry_BlockType {
              id
              image {
                id
                url
                width
                height
              }
            }
          }
        }
      }
    }
  }
}

Here is the result (for both Craft 3.5.9 and 3.5.10.1 this time):

{
  "data": {
    "entry": {
      "id": "417146",
      "blogPromotions": [
        {
          "promotions": [
            {
              "id": "826291",
              "image": []
            }
          ]
        }
      ]
    }
  }
}

The issue seems similar here: https://github.com/verbb/super-table/issues/354

If I disable eager loading directly in the GraphQL code, it works fine for both queries. Would it be possible to include the option to disable eager loading for GraphQL?
Thanks!

3.5.11 release seems to have fixed this problem, both queries now return assets, thanks!

Ah, forgot to mention this issue in the changelog.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

angrybrad picture angrybrad  路  3Comments

michaelhue picture michaelhue  路  3Comments

michel-o picture michel-o  路  3Comments

mccombs picture mccombs  路  3Comments

timkelty picture timkelty  路  3Comments