[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.