Issues with different „Run“ modes and browser

I’m trying to code an app (transcribing audio file into text) which can be accessed from mobile, tablet, etc

I see a different behavior and errors when running the app in various modes

  • „run in split mode“ - everything works fine
  • „run in new tab“ - I get an error but nevertheless a result is shown
  • „publish app“ - I get an error (see screenshot; tested with Chrome, Safari). It happens before I try to connect to an API.

My questions:

  • What is the difference in code execution between the different modes in general?
  • How to make sure that Anvil‘s server code is executed independent from the running mode?
  • Is there a workaround to make the code run after publishing?

Clone link: