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

[BUG] Using count() in a documentList filter query results in a 500 Internal Server Error #6454

Closed
luk-str opened this issue Apr 23, 2024 · 1 comment
Labels

Comments

@luk-str
Copy link

luk-str commented Apr 23, 2024

Describe the bug

This is a problem I stumbled upon after we upgraded one of our projects from v2 to v3 of Sanity Studio.
We have a custom structure for the studio with different document lists, that filter documents based on different groq queries, using the S.documentList().filter() function.
All queries that contain the count() function cause an Interval server error ("Could not fetch list items. Error: Internal server error"). When we remove the count() from the query, the list displays just fine.

Interestingly enough, doing count([1,2,3]) works while count(foo) where foo is the name of a field of type 'array' in a document's schema causes the error.

Also, the query itself hasn't been changed and has been working fine for the last year or so in v2 of Sanity Studio.

To Reproduce

Steps to reproduce the behavior:

  1. Set up a fresh Sanity Studio installation.
  2. Add a document schema with at least one field of type 'array'
  3. Set up a structure and add a documentList to display documents of the type you just created
  4. Add a filter that includes the count() function

Expected behavior

The expected behavior would be for the query to not cause an error and to behave the same way as when querying the API or using the Vision tool.

Which versions of Sanity are you using?

@sanity/cli (global) 3.36.4 (latest: 3.38.0)
@sanity/components 2.14.0 (up to date)
@sanity/document-internationalization 3.0.0 (up to date)
@sanity/eslint-config-studio 4.0.0 (up to date)
@sanity/image-url 1.0.2 (up to date)
@sanity/ui 2.1.4 (up to date)
@sanity/vision 3.38.0 (up to date)
sanity 3.38.0 (up to date)

What operating system are you using?

MacOS 14.2.1

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

10.5.0
v21.7.3

@luk-str luk-str changed the title Using count() in a documentList filter query results in a 500 Internal Server Error [BUG] Using count() in a documentList filter query results in a 500 Internal Server Error Apr 23, 2024
@linear linear bot added the bug label Apr 24, 2024
@rexxars
Copy link
Member

rexxars commented Apr 27, 2024

Thanks for reporting. We've released v3.39.1 which should fix this.

@rexxars rexxars closed this as completed Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants