Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot destructure property 'media' of 'theme.sanity' as it is undefined. #70

Open
ollebergkvist opened this issue Jul 29, 2023 · 9 comments

Comments

@ollebergkvist
Copy link

I get this error after implementing the plugin:

Error: Cannot destructure property 'media' of 'theme.sanity' as it is undefined.
TypeError: Cannot destructure property 'media' of 'theme.sanity' as it is undefined.
    at responsiveFlexItemStyle (webpack-internal:///(app-pages-browser)/./node_modules/@sanity/orderable-document-list/node_modules/@sanity/ui/dist/index.esm.js:3650:5)
    at _e (webpack-internal:///(app-pages-browser)/./node_modules/@sanity/orderable-document-list/node_modules/styled-components/dist/styled-components.browser.esm.js:30:14666)
    at _e (webpack-internal:///(app-pages-browser)/./node_modules/@sanity/orderable-document-list/node_modules/styled-components/dist/styled-components.browser.esm.js:30:14439)
    at _e (webpack-internal:///(app-pages-browser)/./node_modules/@sanity/orderable-document-list/node_modules/styled-components/dist/styled-components.browser.esm.js:30:14938)
    at e.generateAndInjectStyles (webpack-internal:///(app-pages-browser)/./node_modules/@sanity/orderable-document-list/node_modules/styled-components/dist/styled-components.browser.esm.js:30:11176)
    at eval (webpack-internal:///(app-pages-browser)/./node_modules/@sanity/orderable-document-list/node_modules/styled-components/dist/styled-components.browser.esm.js:30:19026)
    at eval (webpack-internal:///(app-pages-browser)/./node_modules/@sanity/orderable-document-list/node_modules/styled-components/dist/styled-components.browser.esm.js:30:19084)
    at P (webpack-internal:///(app-pages-browser)/./node_modules/@sanity/orderable-document-list/node_modules/styled-components/dist/styled-components.browser.esm.js:30:19658)
    at renderWithHooks (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:10697:18)
    at updateForwardRef (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:14682:20)
    at beginWork$1 (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:17373:16)
    at beginWork (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:25689:14)
    at performUnitOfWork (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:24540:12)
    at workLoopSync (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:24256:5)
    at renderRootSync (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:24211:7)
    at recoverFromConcurrentError (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:23446:20)
    at performConcurrentWorkOnRoot (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:23352:22)
    at workLoop (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/scheduler/cjs/scheduler.development.js:261:34)
    at flushWork (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/scheduler/cjs/scheduler.development.js:230:14)
    at MessagePort.performWorkUntilDeadline (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/scheduler/cjs/scheduler.development.js:537:21)
@Slgoetz
Copy link

Slgoetz commented Dec 11, 2023

heads up if you run update all of your sanity packages you should get a fix for this error

@TomaszPosiadala
Copy link

Same issue on latest Sanity version. My package.json:

"dependencies": {
    "@sanity/orderable-document-list": "^1.1.0",
    "@sanity/scheduled-publishing": "^1.2.2",
    "@sanity/vision": "^3.20.0",
    "i": "^0.3.7",
    "npm": "^10.2.5",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-is": "^18.2.0",
    "rxjs": "^7.8.1",
    "sanity": "^3.23.2",
    "sanity-plugin-iframe-pane": "^2.6.1",
    "sanity-plugin-media": "^2.2.4",
    "styled-components": "^6.1.1"
  },
  "devDependencies": {
    "@sanity/eslint-config-studio": "^3.0.1",
    "@types/react": "^18.0.25",
    "eslint": "^8.6.0",
    "prettier": "^3.0.2",
    "typescript": "^5.1.6"
  },

@imbeard
Copy link

imbeard commented Jan 5, 2024

I have the same error too with latest Sanity version, does anybody have a fix/workaround for this?

@wavinginspace
Copy link

Getting the same error :\

@Antoinevenco
Copy link

Antoinevenco commented Jan 11, 2024

Hi, got the same error with latest Sanity version too

EDIT: Got rid of the error by deleting my node_modules and package-lock.json and running npm install again

@laurosilvacom
Copy link

@kmelve, do you have any input on how to fix this? This is a constant error that doesn't have a clear solution.

@DanForder
Copy link

Any updates on this? Currently the only thing blocking me from upgrading a system from Sanity V2 -> V3. Have upgraded everything and done a clean install as recommended but no luck.

@Sandeep18JS
Copy link

Sandeep18JS commented May 16, 2024

@DanForder I'm getting this same error,i have tried lot of things,Have you find any fix for it?

@laurosilvacom
Copy link

@dcilke @kmelve This unresolved issue is significantly affecting my ability to use Sanity across various of my products and clients. As someone who relies on Sanity for efficient and organized content management, this problem is a major disruption to project delivery. What do you need to prioritize this issue from me/us?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants