Link to the documentation page or resource
https://docs.strapi.io/cms/data-management/import
Describe the bug
Summary
The strapi import command, when run against a Strapi instance using a cloud
storage provider, permanently deletes files from the cloud provider for any
media records that exist in the destination database but are not present in the
import archive. This behavior is not documented and results in irreversible
data loss on the cloud provider.
Current documentation warning
The import page states:
"strapi import deletes all existing data, including the database and uploads
directory, before importing the backup file."
This warning only references the local "uploads directory" and gives no
indication that cloud-hosted assets will be deleted via the provider's API.
Impact
- If two environments (e.g. staging and production) share the same cloud
storage account, running strapi import on one environment with an export
from the other will delete any files that were uploaded after the export was
created — permanently removing them from the shared storage and breaking
assets in all connected environments.
- There is no dry-run option, no confirmation prompt specific to cloud assets,
and no way to recover deleted files unless the cloud provider offers its own
backup or versioning feature.
Steps to reproduce
- Set up two Strapi instances (e.g. production and staging) pointing to the
same cloud storage account.
- Upload some files on the staging instance (these will not exist in a
production export).
- Run
strapi export on production to create an archive.
- Run
strapi import -f export.tar.gz.enc on staging.
- Observe that the files uploaded in step 2 are permanently deleted from the
cloud storage provider, even though both environments shared the same
account.
Environment
- Strapi version: v5
- Storage provider: third-party cloud upload provider
- Deployment: cloud-hosted
Additional context
No response
Suggested improvements or fixes
Expected behavior
The ideal fix would be a behavioral change: strapi import should not
delete remote assets for cloud storage providers unless explicitly
instructed to do so via a flag such as --delete-remote-files. Deleting
records from the local database and deleting files from a remote cloud provider
are two fundamentally different operations — the latter should always require explicit opt-in.
At a minimum, the warning box on the documentation for the import page should be updated to include:
If you are using a cloud storage provider (e.g. Cloudinary, AWS S3, Azure
Blob Storage, Google Cloud Storage), any media files whose database records
are removed during import will be permanently deleted from the cloud provider
via its delete API. This affects all environments sharing the same cloud
storage account. To avoid unintended deletion of remote assets, use
--exclude files or ensure each environment uses an isolated storage
bucket/account.
Related issue(s)/PR(s)
No response
Link to the documentation page or resource
https://docs.strapi.io/cms/data-management/import
Describe the bug
Summary
The
strapi importcommand, when run against a Strapi instance using a cloudstorage provider, permanently deletes files from the cloud provider for any
media records that exist in the destination database but are not present in the
import archive. This behavior is not documented and results in irreversible
data loss on the cloud provider.
Current documentation warning
The import page states:
This warning only references the local "uploads directory" and gives no
indication that cloud-hosted assets will be deleted via the provider's API.
Impact
storage account, running
strapi importon one environment with an exportfrom the other will delete any files that were uploaded after the export was
created — permanently removing them from the shared storage and breaking
assets in all connected environments.
and no way to recover deleted files unless the cloud provider offers its own
backup or versioning feature.
Steps to reproduce
same cloud storage account.
production export).
strapi exporton production to create an archive.strapi import -f export.tar.gz.encon staging.cloud storage provider, even though both environments shared the same
account.
Environment
Additional context
No response
Suggested improvements or fixes
Expected behavior
The ideal fix would be a behavioral change:
strapi importshould notdelete remote assets for cloud storage providers unless explicitly
instructed to do so via a flag such as
--delete-remote-files. Deletingrecords from the local database and deleting files from a remote cloud provider
are two fundamentally different operations — the latter should always require explicit opt-in.
At a minimum, the warning box on the documentation for the import page should be updated to include:
Related issue(s)/PR(s)
No response