Issues with importing data and image assets in Sanity CLI
4 replies
Last updated: Jun 9, 2021
K
Hi folks, I've exported a dataset (
My documents that are type
I'm also stumped on how to import images. When I try to import my unmodified exported data, I get the error:
. I've read the docs page that the error message mentions, but the suggested fix doesn't apply because I didn't use
production) and am trying to import the resulting
.ndjsoninto another dataset (
development). I'm using the Sanity CLI, v2.10.5. I'm running into some issues with importing.
My documents that are type
routehave strong references to
pagedocuments, and my
pagedocuments have strong references to image assets. I was able to import my
routedocuments by temporarily changing the references to weak ones (find + replace in my
.ndjson). Is there a better way to do this?
I'm also stumped on how to import images. When I try to import my unmodified exported data, I get the error:
[image ID] references a different project ID than the specified target (asset is in [production_id], importing to [development_id])
--rawwhen exporting. Should I be uploading image files rather than importing image assets?
Jun 8, 2021, 7:36 PM
K
I realized I had exported in a non-standard way, `curl`ing instead of using the
sanity dataset export. I've done the latter, and the image error I mentioned above is no longer an issue. However, now some non-existent assets are being referenced. Gonna spend some time trying to work through this.
Jun 8, 2021, 9:02 PM
H
Note that if you havent manually reset the
Another note is that I have had some problems with importing
large datasets myself. How many documents and assets are you importing and what is the cumulative size of the dataset?
developmentdataset ( ie deleted it to make sure you import to a clean slate š ) it might still contain misconfigured documents from the initial import š¤ if you dont have anything you care about in the
developmentdataset this might be something to attempt.
Another note is that I have had some problems with importing
large datasets myself. How many documents and assets are you importing and what is the cumulative size of the dataset?
Jun 9, 2021, 7:55 AM
H
Note that if you havent manually reset the
Another note is that I have had some problems with importing
large datasets myself. How many documents and assets are you importing and what is the cumulative size of the dataset?
developmentdataset ( ie deleted it to make sure you import to a clean slate š ) it might still contain misconfigured documents from the initial import š¤ if you dont have anything you care about in the
developmentdataset this might be something to attempt.
Another note is that I have had some problems with importing
large datasets myself. How many documents and assets are you importing and what is the cumulative size of the dataset?
Jun 9, 2021, 7:55 AM
K
Thanks for the suggestions! I managed to figure it out. The exported
data.ndjsonhad
file://./images/[image_id]but it needed to be
file:///local/path/to/images/[image_id].
Jun 9, 2021, 2:39 PM
Sanityā build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.