Trying to export/import media, I think I'm missing

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

Trying to export/import media, I think I’m missing something very basic…

You should be able to use the import/export fucionality inside of strapi to get your production data to dev

I’ve tried that, but the import/export gives me a json where the refrences are relative to the specific environment…
So for instance if I have an entry with a field that points to an image, that field will hold the id of the image, which is specific to the media library of that environment.

It should auto fix that if you use the data import command or transfer I think

When i click “export” it gives my a json where the uploads have an id and hashed url (e.g. dog.png turns into dog_hwfkj345.png)

and wheni try and import it into my local strapi instance, it fails because the names don’t correspond…

try transfer

and see if that fixes it

if both cause issues it would be worth opening a isuse