Skip to content

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

@laurosilvacom

Description

@laurosilvacom

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions