diff --git a/packages/core/data-transfer/lib/providers/local-strapi-destination-provider/index.ts b/packages/core/data-transfer/lib/providers/local-strapi-destination-provider/index.ts index f42852baca..08b1fba3c6 100644 --- a/packages/core/data-transfer/lib/providers/local-strapi-destination-provider/index.ts +++ b/packages/core/data-transfer/lib/providers/local-strapi-destination-provider/index.ts @@ -96,13 +96,13 @@ class LocalStrapiDestinationProvider implements IDestinationProvider { if (!this.strapi) { throw new Error('Not able to stream Configurations. Strapi instance not found'); } - const strapi = this.strapi; + return new Writable({ objectMode: true, write: async (config: IConfiguration, _encoding, callback) => { try { - if (this.options.strategy === 'restore') { - await restoreConfigs(strapi, config); + if (this.options.strategy === 'restore' && this.strapi) { + await restoreConfigs(this.strapi, config); } callback(); } catch (error) {