See Sanity in action 👀 Join us for a live product demo + Q&A →

Using Sanity for multi-country content with custom desk structure and filter references.

12 replies
Last updated: Feb 24, 2023
Hey! Has anyone set up the netlify deploy plugin with sanity V3? I followed the docs, but getting the error:
netlifyWidget is not a function
. Wondering if there is something I'm missing here? The dashboard is set up correctly and showing in the studio, but when I add the
netlifyWidget
to the list of widgets inside the
dashboardTool
, I get the error. Copying my plugins snippet to this thread:
Feb 24, 2023, 8:48 PM
plugins: [
    dashboardTool({
        widgets: [
          netlifyWidget({
              title: 'My Netlify deploys',
              sites: []
          })
      ]
    }),
    deskTool({
      structure: deskStructure
    }),
    visionTool()
  ],
Feb 24, 2023, 8:48 PM
sounds like netlifyWidget could be undefined, i'd double check it's importing ok!
Feb 24, 2023, 9:19 PM
does it work in your local/dev environment?
Feb 24, 2023, 9:20 PM
Here's how I'm importing which I believe should be correct per the docs:
import { netlifyWidget } from "sanity-plugin-dashboard-widget-netlify";

Feb 24, 2023, 9:21 PM
I've also tried:
import netlifyWidget from "sanity-plugin-dashboard-widget-netlify";
Feb 24, 2023, 9:22 PM
It's not working in local/dev
Feb 24, 2023, 9:22 PM
did you add sanity-plugin-dashboard-widget-netlify to your dependencies? is it in your package.json?
Feb 24, 2023, 10:04 PM
Yeah it's listed in the dependencies:
"sanity-plugin-dashboard-widget-netlify": "^2.0.1",
Feb 24, 2023, 10:11 PM
if you console.log(netlifyWidget) do you get anything?
ƒ G(e2) {

var t2;

return { name: "netlify-widget", component: () => (0, import_jsx_runtime.jsx)(q, r({}, e2)), layout: null != (t2 = e2.layout) ? t2 : { width: "medium" } };

}
it looks like this in my console when i log the function
Feb 24, 2023, 10:29 PM
After adding
"sanity-plugin-dashboard-widget-netlify": "^2.0.1",
to your dependencies in package.json, did you run
npm i
/
yarn
to install it (and if so, did it install without errors)? That error is consistent with being on version 1 of the dashboard-widget-netlify plugin. Could you please check your lock file (you can search for
sanity-plugin-dashboard-widget-netlify
) to confirm you’re on
v2.0.1
and not
v1.3.2
?
Feb 24, 2023, 10:51 PM
sometimes a good ol'
rimraf node_modules
then reinstall your packages helps
Feb 24, 2023, 10:53 PM
Ahh yeah okay I deleted
node_modules
and ran
yarn
which fixed it. Thanks everyone!
Feb 24, 2023, 10:56 PM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.