Anvil Community Forum

[Fixed] This app has experienced an error: H

When the session expires and needs to be refreshed, this error pops up on the bottom right corner:

image

I have noticed this only recently, I think this is something new. I don’t know if it’s caused by my logic or by Anvil’s session management.

Regardless of whether this is new or it has always been there or it’s my fault, it would be nice to get a better message.

I have the same issue and it seems to caused by by Anvil’s session management.

1 Like

Definitely not new :

1 Like

This is a joke, don’t use this:

try:
  anvil.server.call("foo")
except Exception as err:
  if str(err) == "H":
    raise anvil.server.SessionExpiredError
  else:
    raise

I don’t understand why sometimes you get an “H” in a red box instead of:
image

Like the documentation says you should?

To be honest, I am a bit scared by these kind of bugs, since I am not too sure then the unknown security bugs will bite.

1 Like

This bug has been reported by @david.wylie more than two years ago and has not been fixed.
I’m pretty sure if there was any security concern the Anvil team would have fixed it immediately.
This is just a bad management on the client side of a good exception coming from the server.

1 Like

My point is unknown / unreported security issues.

I just realized this is handled correctly in the IDE (at least the old one, I don’t use the beta), but when I open the app in a new browser window I can reproduce the “H” redbox by doing
raise anvil.server.SessionExpiredError

Thanks for raising this @stefano.menci. I’ve moved it to bug reports and ticketed it internally.

This should now be fixed

1 Like

Thanks @brooke, really appreciate that.

Example Link: (if I used a cone link, the IDE does not display the behaviour)

https://ARP5U3I6BKL2Q4P3.anvil.app/YADNYRX7LZH5SUMIRZOG3U5K

It now correctly displays the correct timed out error alert box, however it still has the red error box with “H” in it.
image

image

Is this the desired behaviour?

Here is the only code in the app, using one button and material design:
(mostly copied from the docs)

  def primary_color_1_click(self, **event_args):
    try:
      raise anvil.server.SessionExpiredError
    except anvil.server.SessionExpiredError:
      #anvil.server.reset_session()
      # This will work now, but with a blank session
      #anvil.server.call("foo")
      print("foo")
      raise

Edit: oh also i had to import anvil to access the exception class.

I spoke a bit too soon about the error being fixed. The fix hasn’t been made public yet, so sorry about that!

1 Like

Ok great, Ill wait for it to show up on

:construction_worker_woman: :grinning:

1 Like

that fix should now be live.

1 Like