This is something that I struggled with, and couldn't find a quick answer for. Ultimately, I realized that I wasn't reviewing the Parse documentation properly.
Problem
If you're reading this question, perhaps you're getting the following error in your Cloud Code error log
Result: TypeError: Cannot call method '_toPointer' of null
when you try to call the .query() method of a Parse.Relation.