How to find pages that use a specific file in the backup (assets folder) in Sanity.io

6 replies
Last updated: Jul 12, 2021
Hi! If I found a big file in the backup (assets folder), is there a quick way to understand what pages use it?
Jul 7, 2021, 12:54 PM
Here’s one that will find your five largest (by file size) image assets and return the documents that reference them:

*[_type == 'sanity.imageAsset'] | order(size desc) {
  'references': *[references(^._id)],
  size,
  _id,
}[0...5]
Here’s the same, but only returning those assets that aren’t referenced:


*[_type == 'sanity.imageAsset'] | order(size desc) {
  'references': *[references(^._id)],
  size,
  _id,
}[count(references) == 0][0...5]
Jul 7, 2021, 5:39 PM
user A
thank you! I've tried to install https://www.sanity.io/plugins/vision to allow customer running groq queries in the admin panel and now get the error when start studio:

Uncaught error
_client.default.withConfig is not a function

Stack:

TypeError: 
    at Object.&lt;anonymous&gt; (<http://localhost:3333/admin/static/js/app.bundle.js:256518:30>)
    at __webpack_require__ (<http://localhost:3333/admin/static/js/vendor.bundle.js:713:30>)
    at fn (<http://localhost:3333/admin/static/js/vendor.bundle.js:118:20>)
    at Object.&lt;anonymous&gt; (<http://localhost:3333/admin/static/js/app.bundle.js:256462:44>)
    at __webpack_require__ (<http://localhost:3333/admin/static/js/vendor.bundle.js:713:30>)
    at fn (<http://localhost:3333/admin/static/js/vendor.bundle.js:118:20>)
    at Object.&lt;anonymous&gt; (<http://localhost:3333/admin/static/js/app.bundle.js:76925:3>)
    at __webpack_require__ (<http://localhost:3333/admin/static/js/vendor.bundle.js:713:30>)
    at fn (<http://localhost:3333/admin/static/js/vendor.bundle.js:118:20>)
    at Object.&lt;anonymous&gt; (<http://localhost:3333/admin/static/js/app.bundle.js:98143:36>)
Jul 8, 2021, 9:11 AM
That error seems to creep up now and again. It could be due to a plugin version mismatch, in which case running
sanity upgrade
might fix it. If not, you could try deleting
node_modules
and then running
sanity install
.
Jul 8, 2021, 6:45 PM
user A
thank you, sanity update helped 🙂
Jul 12, 2021, 11:33 AM
user A
thank you, sanity update helped 🙂
Jul 12, 2021, 11:33 AM
Great!
Jul 12, 2021, 2:13 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?