TL;DR:
Exporting production instance of strapi, but when I tried to then import into my development strapi, it fails because the media names and IDs aren’t the same (since they receive a different ID and hash in each strapi instance)
I’ll start off by saying that it’s my first time using strapi and I think I’m missing some basic understanding of how to manage files and media, because this seems like such a basic issue and yet I’ve found ZERO mentions of this online. So surely I’m doing something wrong…
I’m working on a project where I need to sync content between production and local development environments in Strapi.
My approach involves exporting data from production to JSON and then importing it into my local instance. This process works well for textual content but fails for images due to the direct URLs and asset IDs in the JSON pointing to the production environment’s media library.
For example, after export, I have a JSON entry like this:
"plugin::upload.file": { "6": { "id": 6, "name": "amit.png", "url": "/uploads/amit_b1eb7b0b8b.png" } }
But when imported into the local environment, I encounter errors due to non-existing asset IDs and irrelevant URLs:
Error: { "code": "ERR_INVALID_URL", "input": "/uploads/amit_f818a27755.png", "level": "error" }
Both environments have identical media structure (e.g., a “banners” folder with images). How can I correctly import the media files so that the URLs are valid in the target environment?
This topic has been created from a Discord post (1216079829116653669) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord