"InvalidSession" when trying to remove a logged out user from Realm App

I’m building a test react webapp, and somehow got into the state where my Realm.App.currentUser is a loggedOut, “active” user. When I try to remove tracking of this user altogether, I get an InvalidSession error. I’m confused by this error, since why would this user need a valid session in order to be removed from the Realm app altogether? Is this inconsistent state supposed to be possible? See the console log statements below for the weird state this user seems to be in:

console.log("got invalid session...")
console.log("current_user id is " + app.currentUser.id)
console.log("isLoggedIn is " + app.currentUser.isLoggedIn)
console.log("state is " + app.currentUser.state)
console.log("attempting to remove " + app.currentUser.id)
await app.removeUser(app.currentUser)

Which prints out in order:

indent preformatted text by 4 spaces
current_user id is 60298bf0537dbb177e356e89
isLoggedIn is undefined
state is active
attempting to remove 60298bf0537dbb177e356e89

and on the removeUser call it gives me the following error

{“method”:“DELETE”,“url”:“https://stitch.mongodb.com/api/client/v2.0/auth/session",“statusText”:“”,“statusCode”:401,“errorCode”:"InvalidSession”}

Questions:

  1. how could the isLoggedIn variable be undefined? According to the docs it’s supposed to be either True or False.
  2. how could the user be active, when its loggedIn state is undefined?
  3. Why does Realm need a valid session to remove the user at all?