I'm working on an article filter right now. Each article has a group field that contains a content relationship to the "Categories" custom type. I've set up the query to filter by Categories like so:
const newsArticles = await $prismic.api.query(
[
$prismic.predicates.any('my.news_articles.categories.category', [
'document-id-here',
]),
],
)
(Note: "document-id-here" is just a placeholder. I am testing this with real IDs)
If at least one of my news_articles documents has content in the "Categories" group field, the query works. However, if none of the news_articles documents have any content in the "Categories" group field, the query fails with the following error and breaks the site:
Unexpected status code [400] on URL https://example.cdn.prismic.io/api/v2/documents...
In the Network tab, the error reads:
[function any(..)] unexpected field 'my.news_articles.categories.category' on line:1 col:7 in query '[[any(my.news_articles.categories.category, ["document-id-here"])]]'\n[[any(my.news_articles.categories.category, ["document-id-here"])]]\n ^\n
After doing some digging, I found this issue only occurred if the empty field was in a tab other than Main. I was able to reproduce the error with multiple field types ONLY if they were in a different tab than Main. Prismic handled the same empty field types in the Main tab without error.