Error when adding document actions in Sanity studio, resolved by fixing a typo in the function name.

6 replies
Last updated: Jul 14, 2022
Hi, I followed the instructions on adding Document Actions but I’m getting an error in the studio:

TypeError: Cannot read properties of undefined (reading 'name')

at getHookId (/static/js/app.bundle.js:245293:29)

at <http://localhost:3333/static/js/app.bundle.js:245373:35>

at (&lt;anonymous&gt;)

at GetHookCollectionState (/static/js/app.bundle.js:245373:23)

at renderWithHooks (/static/js/vendor.bundle.js:19162:18)

at mountIndeterminateComponent (/static/js/vendor.bundle.js:21841:13)

at beginWork (/static/js/vendor.bundle.js:22955:16)

at HTMLUnknownElement.callCallback (/static/js/vendor.bundle.js:4547:14)

at Object.invokeGuardedCallbackDev (/static/js/vendor.bundle.js:4596:16)

at invokeGuardedCallback (/static/js/vendor.bundle.js:4651:31)

I copied the code exactly from the example and also tried to remove
and reinstalling everything.
If I remove the
from the
it’s all working, so I think it’s somehow related to the Action, but the action code is identical to the example. Anything I can do to get document actions working?
Jul 14, 2022, 7:37 PM
Hey Nils! When does that error pop up? Is it when you try to use the document action or when you add it to your
Jul 14, 2022, 7:47 PM
user M
, it happens I add it to
and try to load any document in the studio. So I don’t even get so far to try to use the document action
Jul 14, 2022, 7:55 PM
Those are my sanity versions:

"@sanity/base": "^2.30.1",

"@sanity/components": "^2.14.0",

"@sanity/core": "^2.30.2",

"@sanity/dashboard": "^2.30.1",

"@sanity/default-layout": "^2.30.1",

"@sanity/default-login": "^2.30.1",

"@sanity/desk-tool": "^2.30.1",

"@sanity/eslint-config-studio": "^2.0.0",

"@sanity/production-preview": "^2.29.3",

"@sanity/vision": "^2.30.1",

"sanity-plugin-asset-source-unsplash": "^0.1.3",

"sanity-plugin-iframe-pane": "^1.0.16",

"sanity-plugin-seo-pane": "^1.3.1",
Jul 14, 2022, 7:56 PM
Can you share:1. The part where you add
to your
2. Your
3. Your exact code for your
I know you said it's an exact copy, but we should start by double checking.
Jul 14, 2022, 7:58 PM
Hi, thanks I double checked and actually found the issue. I had a typo in the function name. The import didn’t complain, but once I renamed the function it’s now working. Thanks!
Jul 14, 2022, 8:12 PM
Jul 14, 2022, 8: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?