Error message on empty document

Hello,

When I try to execute the following code (see image below) and I have no events in prismic I get a 400 error code bad request. But when I fill in 1 event it works, but there are situations that there are no events filled in.

Hi Team,

Welcome to the community!

Are you trying to say that when there are no results returned, as in no 'events' documents, you get a 400 error? If so this is expected behavior.