From f4d689e431c409d1cc80803aeb0ab87eeb0fb20f Mon Sep 17 00:00:00 2001 From: Boaz Poolman Date: Sat, 23 Apr 2022 14:49:13 +0200 Subject: [PATCH] fix: Filter records with missing data and register a warning about it in the Strapi logs. --- server/config/type.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/config/type.js b/server/config/type.js index 06087e6..4578e77 100644 --- a/server/config/type.js +++ b/server/config/type.js @@ -183,6 +183,12 @@ const ConfigType = class ConfigType { await Promise.all(Object.values(AllConfig).map(async (config) => { const combinedUid = getCombinedUid(this.uidKeys, config); const combinedUidWhereFilter = getCombinedUidWhereFilter(this.uidKeys, config); + + if (!combinedUid) { + strapi.log.warn(logMessage(`Missing data for entity with id ${config.id} of type ${this.configPrefix}`)); + return; + } + // Check if the config should be excluded. const shouldExclude = !isEmpty(strapi.config.get('plugin.config-sync.excludedConfig').filter((option) => `${this.configPrefix}.${combinedUid}`.startsWith(option))); if (shouldExclude) return;