Js - Cannot read property 'filter' of undefined

Hello, i’m working with the 2.1.5 client and when I try to fetch the presences of the match it throws me this error:

Cannot read property 'filter' of undefined
connectedOpponents = match.presences.filter((presence) => {
    // Remove your own user from list.
    return presence.user_id != match.self.user_id;
});

I looked into my ‘match’ variable and it doesn’t contain something called like ‘presences’.

@ameza I think that’s a typo in the documentation because you should look at the "joins" and "leaves" and apply them to your local list of presences to determine what the state change looks like when it’s been observed.

1 Like