Skip to content

[5.x]: Upgrading from Craft v4.14.5 (latest) to Craft v 5 has GraphQL reference issues #16713

@jedimonkey

Description

@jedimonkey

What happened?

Description

I have a headless site using the public schema to pull content on a CraftCMS v4 site. I followed the steps outlined in https://craftcms.com/docs/5.x/upgrade.html to upgrade to v5 of Craft CMS. The frontend uses the GraphQL api would make use of the [section]_default_Entry type usage, however with v5, these now are remapped to [section]_Entry type, which I was going through and fixing our api calls. But I was finding that some fields / types were inaccessible and verified via the GraphiQ interface which also wasn't showing up these entry types to expose the fields. Went through thinking that permissions or I had made an error in the steps, also tried renaming the Entry for teams (as it was called team_default) however I went through the yaml files and found that it had incorrectly made for some sections the following structure:

entryTypes:
  -
    handle: default
    uid: e2107289-8127-4c53-bda3-77f2e6df2c39 # team

Where searching for uid, showed it was called 'team' in the project.yaml meta names:
e2107289-8127-4c53-bda3-77f2e6df2c39: team # team

Removing the handled: default and forcing it to reapply fixed the issue and team_Entry became accessible. Not 100% sure why/how the entry types in v4 were all mostly default as some have meaningful names, but I can see in the v4 yaml that there is about 8 of them that all start with default and the teams one looks like this (sans the field layout):

handle: default
hasTitleField: true
name: team
section: 9f7abffd-8709-4945-b868-9e6b26e843e2 # The team
showStatusField: true
slugTranslationKeyFormat: null
slugTranslationMethod: site
sortOrder: 1
titleFormat: null
titleTranslationKeyFormat: null
titleTranslationMethod: site

Steps to reproduce

  1. Install Craft v4, configure fields and section, leaving the entry type called Default.
  2. Verify that you can access fields in the GraphiQ explorer using '[section]_default_Entry.
  3. Upgrade Craft to v5
  4. Attempt to access the fields via [section]_Entry

Note - in this case, this site has been around for a while, so these fields/sections/entry types would have been created with a much older version of craft v4.

Expected behavior

Should be able to access these types and fields (with the newer names in the format of [section]_Entry)

Actual behavior

Any 'default' handle entry types are inaccessible via GraphQL, including modifying the entries via the CMS console. Only after modifying the yaml files are they now accessible (although need to do more thorough testing).

Craft CMS version

5.6.6

PHP version

8.2.27

Operating system and version

Debian 12 (using DDEV)

Database type and version

MySQL 8.0

Image driver and version

No response

Installed plugins and versions

   Name          Handle         Package Name                 Version  Installed  Enabled
   ------------  -------------  ---------------------------  -------  ---------  -------
   AsyncQueue    async-queue    ostark/craft-async-queue     4.0.0    Yes        Yes    
   BlurHash      blur-hash      dodecastudio/craft-blurhash  3.0.3    Yes        Yes    
   CKEditor      ckeditor       craftcms/ckeditor            4.5.0    Yes        Yes    
   ElasticEmail  elastic-email  bertoost/craft-elasticemail  v2.0.3   Yes        Yes    
   Feed Me       feed-me        craftcms/feed-me             6.7.0    Yes        Yes    
   Formie        formie         verbb/formie                 3.0.20   Yes        Yes    
   Maps          simplemap      ether/simplemap              5.0.4    Yes        Yes    
   Navigation    navigation     verbb/navigation             3.0.6    Yes        Yes    
   SEO           seo            ether/seo                    5.0.0    Yes        Yes    
   Super Table   super-table    verbb/super-table            4.0.3    Yes        Yes    
   Webhooks      webhooks       craftcms/webhooks            3.1.0    Yes        Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions