runway: Entries fieldtype data not displayed in GraphQL

Description

I have an entries fieldtype on my model with a max > 1. The entry_ids are stored in a json column in the db and all works as expected in the control panel.

The issue is querying the GraphQL endpoint leads to null values being returned for the array of entries. CleanShot 2023-05-02 at 14 32 04@2x

Steps to reproduce

// Blueprint
-
  handle: attributes_internal
  field:
    mode: default
    collections:
      - traits
    display: 'Attributes Internal'
    type: entries
    icon: entries
// Model 

 protected $casts = [
    'attributes_internal' => 'array'
  ];
// DB `attributes_internal` column
["7193d09c-af21-4183-a9a5-f52a4ee7afe7","ec45f079-dea7-477d-9a7f-cc91d8f49561","9e99d0ad-4edc-495a-a1a8-f7a6a4a5f614","f2e57954-748c-4014-927b-b254500269ee"]
// GraphQL Query
query MyQuery {
  model(limit: 2) {
    data {
      title
      variant_args_local
      attributes_internal {
        title
        id
      }
    }
  }
}

// Response
"errors": [
    {
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 5,
          "column": 7
        }
      ],
      "path": [
        "model",
        "data",
        0,
        "variant_args_local"
      ]
    },
    ...
],
"data": {
    "model": {
      "data": [
        {
          "title": "LILY #3019",
          "variant_args_local": null,
          "attributes_internal": [
            null,
            null,
            null,
            null,
            null,
            null,
            null
          ]
        },
     ...
   }

Environment

Environment
Application Name: [LOCAL]
Laravel Version: 9.52.7
PHP Version: 8.2.1
Composer Version: 2.5.4
Environment: local
Debug Mode: OFF
URL: localhost:3000
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: pgsql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 2
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 3.4.8 PRO

Statamic Addons
aryehraber/statamic-impersonator: 2.4.1
doublethreedigital/runway: 4.2.5

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

awesome stuff – thanks @duncanmcclean !

Awesome! Good to know I’m seeing the same thing.

I’ll dig in when I can.

Honestly, I’m not sure what’s the issue without digging in myself (so unsure where best to point you).

Hoping to be able to take a look within the next couple of days.

Ah, must be a bigger issue then! GraphQL feels like a bit of a black box to me too - I added it to Runway during a pairing session with Jason 😆

Would you be able to try adding this to your Eloquent model and see if it helps at all?

use \Statamic\GraphQL\ResolvesValues;

public function augmentedValue($key) 
{
    return $this->{$key};
}

It’s essentially the fix from the v5.0. I think it fixes a different GraphQL issue (where an error was being thrown) but who knows.