[FIXED] Internal server error when using `where` field in GraphQL API

I’m getting a server error when trying to query using the where filter.

1 Like

Hello @asa!

[ UPDATE ] We’ve just released a fixed for this issue. If you want to have access to the fix send us a private message with the url of your repository!

This is happening because, if the API ID for field has an underscore, this can cause the query to break. You can solve this by changing the API ID of the field to be able to perform the query: visibleonsite . Just remember that If you do this, it will cause the content of the original field to disappear from all existing documents. You’ll need to re-populate the new field with content after changing its API ID.

To learn more about this, read this article: What happens if I remove or rename the API ID of a field on a Custom Type.

@paulina.gavilan Thanks for the explanation, I think this was the cause of my ticket as well.

Is there a plan for the Prismic team to fix this? Naming a field with an underscore is a completely reasonable ask, especially since api fields appear to only allow lowercase characters. Using an underscore to make a field more readable shouldn’t break querying

1 Like

[ UPDATE ] We’ve just released a fixed for this issue. If you want to have access to the fix send us a private message with the url of your repository!

@alex I’m glad you found the answer!

You’re are totally right, it would be a reasonable thing to have as a possibility when creating queries.

I’ve submitted it as a bug to the issue tracker so that the dev team can be aware of it.

For anyone who needs this fix activated on their account please send a private message to the Activations Team with your repository name as described in this post. :grin: