diff --git a/packages/strapi-plugin-graphql/services/GraphQL.js b/packages/strapi-plugin-graphql/services/GraphQL.js index 7fde6f9a9e..a85430cd70 100644 --- a/packages/strapi-plugin-graphql/services/GraphQL.js +++ b/packages/strapi-plugin-graphql/services/GraphQL.js @@ -533,7 +533,10 @@ module.exports = { const entry = withRelated && withRelated.toJSON ? withRelated.toJSON() : withRelated; - entry[association.alias]._type = _.upperFirst(association.model); + // Set the _type only when the value is defined + if (entry[association.alias]) { + entry[association.alias]._type = _.upperFirst(association.model); + } return entry[association.alias]; }