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

Destructuring Assignment Error When Implementing sanity-plugin-cloudinary in a Next.js and Sanity Project #63

Open
laurosilvacom opened this issue Dec 21, 2023 · 1 comment

Comments

@laurosilvacom
Copy link

Describe the bug

I'm trying to implement the cloudinarySchemaPlugin from the sanity-plugin-cloudinary package in my Sanity project. However, I'm encountering an error:

Error: Right side of assignment cannot be destructured
responsiveStackSpaceStyle@
_e@
@
@
@
renderWithHooks@
updateForwardRef@
beginWork@
performUnitOfWork@
workLoopSync@
renderRootSync@
recoverFromConcurrentError@
performSyncWorkOnRoot@
flushSyncWorkAcrossRoots_impl@
flushSyncWorkOnAllRoots@
processRootScheduleInMicrotask@
@

This error occurs when navigating to the resource where the cloudinary.asset is defined.

To Reproduce

Steps to reproduce the behavior:

  1. Install sanity-plugin-cloudinary using pnpm add sanity-plugin-cloudinary.
  2. Import cloudinarySchemaPlugin in the Sanity configuration file and add it to the plugins array.
  3. Declare a field to be cloudinary.asset in the schema.
const lesson = {
  name: 'lesson',
  title: 'Lesson',
  type: 'document',
  fields: [
    {
      name: 'title',
      title: 'Title',
      type: 'string',
    },
    {
      name: 'slug',
      title: 'Slug',
      type: 'slug',
      options: {source: 'title', maxLength: 96},
    },
    {
      name: 'url',
      title: 'URL',
      type: 'url',
    },
    {
      type: 'cloudinary.asset',
      name: 'image',
      description: 'This asset is served from Cloudinary',
    },
    {
      name: 'content',
      title: 'Content',
      type: 'array',
      of: [{type: 'block'}],
    },
  ],
}

export default lesson
  1. Run the project.

Expected behavior

I expected the cloudinarySchemaPlugin to be implemented successfully without any errors.

Screenshots

image

Which versions of Sanity are you using?

'2023-11-08'

What operating system are you using?

Darwin laurosilvacom 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:27:27 PDT 2023; root:xnu-10002.41.9~6/RELEASE_X86_64 x86_64

Which versions of Node.js / npm are you running?

9.2.0
v19.3.0

Additional context

  • Next.js: "next": "14.0.4"
  • React: "react": "^18.2.0"
  • Sanity: "sanity": "^3.21.3"

These are the versions of the packages that my project is currently using.

@bobinska-dev
Copy link

bobinska-dev commented Jan 22, 2024

BTW: When these kind of issues arise (conflicts of dependencies), you can just make sure both are installed like this:

npm i <YOUR DEP> --legacy-peer-deps

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

2 participants