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

GraphQL file fields cannot be renamed since rc-94 #8422

Closed
3 tasks done
moeriki opened this issue Sep 29, 2021 · 1 comment
Closed
3 tasks done

GraphQL file fields cannot be renamed since rc-94 #8422

moeriki opened this issue Sep 29, 2021 · 1 comment

Comments

@moeriki
Copy link
Contributor

moeriki commented Sep 29, 2021

Preflight Checklist

Describe the Bug

When I query a collection with a single file field I can no longer rename the field.

GraphQL returns.

Cannot destructure property 'type' of 'field' as it is undefined.

To Reproduce

Create a new collection test with a default id and add one "Single File" file field. You'd end up with something like this.

CREATE TABLE `test` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `file` char(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `test_file_foreign` (`file`),
  CONSTRAINT `test_file_foreign` FOREIGN KEY (`file`) REFERENCES `directus_files` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

You could add an item to the collection for easier debugging, but it isn't necessary to reproduce the issue.

Query the file field with permissions (or set public read access to the collection and directus_files).

Without renamed fields it works fine 👍

{
  test {
    file { id }
  }
}

With a renamed field it returns an error ⚠️

{
  test {
    renamedField: file { id }
  }
}
{
  "errors": [
    {
      "message": "Cannot destructure property 'type' of 'field' as it is undefined.",
      "locations": [
        {
          "line": 1,
          "column": 17
        }
      ],
      "path": [
        "test"
      ]
    }
  ],
  "data": {
    "test": null
  }
}

This was not an issue in rc-93. The issue is producible in both rc-94 and rc-95.

I dug into the code and commits between those versions without success. If I have to guess I'd say it came with the Insight module changes.

What version of Directus are you using?

v9.0.0-rc.95

What version of Node.js are you using?

14.16.0

What database are you using?

mysql:5.7

What browser are you using?

Firefox Developer Edition

What operating system are you using?

macOS

How are you deploying Directus?

Jenkins

@rijkvanzanten
Copy link
Member

Duplicate of #8402 👍🏻

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants