CLI: sanity dataset import fails on missing metadata
See original GitHub issueDescribe the bug
I’m running sanity dataset export production && sanity dataset import production.tar.gz staging --replace
to sync my production dataset to my staging dataset.
One of my images is missing some metadata. During the import
, this image throws an error and the whole process is stopped:
✔ Exporting documents... (66/66)
✔ Downloading assets... (643/643)
✔ Adding assets to archive...
✔ Clearing temporary files...
Export finished (5m 28.8s)
✔ [100%] Fetching available datasets
✔ [100%] Reading/validating data file (223ms)
✔ [100%] Importing documents (2.47s)
✖ [ 71%] Importing assets (files/images) (46.81s)
o: Failed to upload image @ file:///var/folders/d7/tlsyl3dx2f73v9j7ght57cqm0000gn/T/sanity-import/production-export-2019-04-19t20-36-52-029z/images/542138d111351763702ad45995e5737409c13278-2192x2852.png:
Bad Request - Invalid image, could not read metadata
at onResponse (~/Sites/myproject/myproject.com/node_modules/@sanity/cli/bin/sanity-cli.js:6489:535)
at t.(anonymous function).reduce (~/Sites/myproject/myproject.com/node_modules/@sanity/cli/bin/sanity-cli.js:4895:242)
at Array.reduce (<anonymous>)
at ~/Sites/myproject/myproject.com/node_modules/@sanity/cli/bin/sanity-cli.js:4895:226
at ~/Sites/myproject/myproject.com/node_modules/@sanity/cli/bin/sanity-cli.js:4883:919
at a (~/Sites/myproject/myproject.com/node_modules/@sanity/cli/bin/sanity-cli.js:4883:1028)
at E (~/Sites/myproject/myproject.com/node_modules/@sanity/cli/bin/sanity-cli.js:4931:1352)
at u (~/Sites/myproject/myproject.com/node_modules/@sanity/cli/bin/sanity-cli.js:4931:2878)
at s.<anonymous> (~/Sites/myproject/myproject.com/node_modules/@sanity/cli/bin/sanity-cli.js:2345:181)
error Command failed with exit code 1.
To Reproduce
You’re welcome to give this a try with the same dataset (I just ask that you import
it into a separate instance). You can DM me on slack for the project info.
Expected behavior
I would expect (or hope) that this command would bypass the broken image, and report it as a warning at the end of the command. Or, better yet, find some way to repair the missing metadata.
Which versions of Sanity are you using?
@sanity/cli 0.140.14 (up to date)
@sanity/base 0.140.12 (up to date)
@sanity/cli 0.140.14 (up to date)
@sanity/components 0.140.12 (up to date)
@sanity/core 0.140.12 (up to date)
@sanity/default-layout 0.140.14 (up to date)
@sanity/default-login 0.140.15 (up to date)
@sanity/desk-tool 0.140.14 (up to date)
@sanity/image-url 0.140.12 (up to date)
@sanity/vision 0.140.14 (up to date)
What operating system are you using?
Mac OS
Which versions of Node.js / npm are you running?
6.9.0
v10.5.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (4 by maintainers)
I think this has recurred; I’m on
@sanity/cli 2.4.0
This is still breaking for me. When I unpack the archive and find the files that cause the issue, they are “broken” ones like this:
The image isn’t broken in the main dataset - when I explore the files straight from the Sanity dashboard - but appears to have been messed up somehow in the download process.