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

TypeError: Cannot set properties of undefined (setting 'error') #225

Open
hari-houdini opened this issue Jul 23, 2024 · 0 comments
Open

Comments

@hari-houdini
Copy link

hari-houdini commented Jul 23, 2024

Describe the bug
I logged in as a user with read-only permissions (Viewer role). I still have the option to upload a new media file and delete one. When I perform any of those actions, it throws an error.

To Reproduce
Steps to reproduce the behavior:

  1. Create a user and assign Viewer role to it.
  2. Upload any media asset through the Upload assets button on the top-right corner.
  3. It would throw an error: TypeError: Cannot set properties of undefined (setting 'error')
  4. Then click on any media and delete it through the Delete button on the bottom-left corner.
  5. It would set the media in a constant loading state and throw an error: Insufficient permissions: permission "create" required

Expected behavior
Either the button should be disabled as it is across the rest of Sanity (or) some way to pass user permissions as part of the config

Screenshots
Screenshot 2024-07-23 at 12 06 54
Screenshot 2024-07-23 at 12 07 37
Screenshot 2024-07-23 at 12 16 11

Plugin and environment information:

  • Plugin version

"sanity-plugin-media": "^2.2.5"

  • Sanity version
@sanity/cli (global)                   3.50.0 (latest: 3.52.0)
@sanity/color                           3.0.6 (up to date)
@sanity/color-input                     3.1.1 (up to date)
@sanity/document-internationalization   3.0.0 (up to date)
@sanity/form-builder                   2.36.2 (up to date)
@sanity/icons                           3.3.0 (latest: 3.3.1)
@sanity/image-url                       1.0.2 (up to date)
@sanity/language-filter                 4.0.2 (up to date)
@sanity/ui                              2.6.8 (latest: 2.8.8)
@sanity/util                           3.50.0 (latest: 3.52.0)
@sanity/vision                         3.50.0 (latest: 3.52.0)
@sanity/webhook                         4.0.4 (up to date)
sanity                                 3.50.0 (latest: 3.52.0)
  • Operating system and version [e.g. OS X 13.3.1]

MacOS Sonoma Version 14.5

  • Browser and version number [e.g. Safari 16.4]

Arc Version 1.52.0

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

1 participant