fix: Filter records with missing data and register a warning about it in the Strapi logs.

pull/52/head
Boaz Poolman 2022-04-23 14:49:13 +02:00
parent c0445de79a
commit f4d689e431
1 changed files with 6 additions and 0 deletions

View File

@ -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;