File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,12 @@ const ConfigType = class ConfigType {
183183 await Promise . all ( Object . values ( AllConfig ) . map ( async ( config ) => {
184184 const combinedUid = getCombinedUid ( this . uidKeys , config ) ;
185185 const combinedUidWhereFilter = getCombinedUidWhereFilter ( this . uidKeys , config ) ;
186+
187+ if ( ! combinedUid ) {
188+ strapi . log . warn ( logMessage ( `Missing data for entity with id ${ config . id } of type ${ this . configPrefix } ` ) ) ;
189+ return ;
190+ }
191+
186192 // Check if the config should be excluded.
187193 const shouldExclude = ! isEmpty ( strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . filter ( ( option ) => `${ this . configPrefix } .${ combinedUid } ` . startsWith ( option ) ) ) ;
188194 if ( shouldExclude ) return ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const { isEmpty } = require('lodash');
44const fs = require ( 'fs' ) ;
55const util = require ( 'util' ) ;
66const difference = require ( '../utils/getObjectDiff' ) ;
7+ const { logMessage } = require ( '../utils' ) ;
78
89/**
910 * Main services for config import/export.
@@ -118,6 +119,12 @@ module.exports = () => ({
118119 }
119120
120121 const fileContents = await strapi . plugin ( 'config-sync' ) . service ( 'main' ) . readConfigFile ( type , name ) ;
122+
123+ if ( ! fileContents ) {
124+ strapi . log . warn ( logMessage ( `An empty config file '${ file } ' was found in the sync directory` ) ) ;
125+ return ;
126+ }
127+
121128 fileConfigs [ `${ type } .${ formattedName } ` ] = fileContents ;
122129 } ) ) ;
123130
You can’t perform that action at this time.
0 commit comments