Strange instanceof error on anvil.users.get_user()

What I’m trying to do:

Get the current user using anvil.users.get_user(). This generally works, but tonight logs showed an odd error. It might be connection related, but I figured I’d drop the log here in case it’s something the Anvil staff needs to look at.

: TypeError: Right-hand side of 'instanceof' is not an object
AppOfflineError: Connection to server failed (1006)
at anvil-services/anvil/users/__init__.py, line 83
called from anvil-services/anvil/users/__init__.py, line 83
called from MainForm, line 101

That line 101 is the call to get the current user.

Thanks for reporting.

Is it consistent?
We might need to get some more logging for that line.

could you wrap that line in in a try/except

from anvil.js import ExternalError

try:
    ....
except ExternalError as e:
    print("GET_USER EXTERNAL ERROR") # for searching logs
    print(e)
    print("STACK")
    print(e.original_error.stack)
    raise e

Not at all consistent. It was just the once, and was followed by a couple more AppOfflineErrors.

I’ll put in the try/except and let you know if it happens again.

1 Like