Introspective GQL query doesn't return all fields of my custom content-type

[details=“System Information”]

  • Strapi Version: 4.13.2
  • Operating System: Mac OS
  • Database: Postgres@14
  • Node Version: v18.17.1
  • NPM Version: 8.1.0
  • Yarn Version: 1.22.19

TL;DR: After a recent upgrade, from Strapi v4.10.5 to 4.13.2, the following sneaky phenomenon appeared: When I post the following introspective GQL query, Strapi omits some fields, such as the email field, of my custom content type:

{
  __type(name: "ComponentSectionsProfileForm") {
    name
    kind
    fields {
      name
      type {
        name
        kind
        ofType {
          name
          kind
        }
      }
    }
  }
}

Result: Some, BUT NOT ALL of my content type’s fields are returned:

{
  "data": {
    "__type": {
      "name": "ComponentSectionsProfileForm",
      "kind": "OBJECT",
      "fields": [
        {
          "name": "id",
          "type": { … }
        },
        // expected here would be email but it's just not there, and some others are missing
        {
          "name": "emailPlaceholder",
          "type": {
            "name": "String",
            "kind": "SCALAR",
            "ofType": null
          }
          // and some more that appear and some more that don't
        }

This leads to my corporate-starter template home page to show a 402 Not Found error because api.js gets the error Cannot query field "email" on type "ComponentSectionsProfileForm". from GraphQL.

My hypothesis is, when Strapi backend starts up, it loads and caches the object model and translates it into a GraphQL schema. For some bizarre reason, with version 4.10.5 it finds my email component, but with Strapi code version 4.13.2 (or somewhere in-between) it started to fail to find some fields, including my ‘email’ field.

I wouldn’t even begin to understand how Strapi, with Apollo, builds the internal mapping of fields to the GraphQL schema. There is no .yaml file created in any cache folder; I believe this is all done in memory at launch.

Is this a known quirk in 4.13.2? Should I upgrade to the latest version? (I am afraid it could make things worse.) What is the best way to begin troubleshooting this?

Well, answering my own question here, after renaming the field in question, which I had called “email”, into “emailAddress”, GraphQL found the field and my frontend user interface appeared again. Go figure. Apparently between version 4.10 and 4.13, “email” became a bad name to use for your custom content type fields.

It would be lovely if illegal field names were warned about, either during the build phase, or when saving / modifying the same in the Content Type Builder. Would have saved me 2 days of my life lol…