Published branch stopped working

What I’m trying to do:
Connect dev and published branch with two different backend server
In Backend server, I am using anvil.server.connect(“Key”) for published and anvil.server.connect(“Key-DEV”) for development purpose.

I am calling server method from frontend Anvil UI as :
try:
anvil.server.call(“Anvil_Get_Start_End_Date”,None)
except Exception as e:
print(“Problem connecting: %s” % e)
print(“caught an exception, now we can handle the problem in here”)

Anvil_Get_Start_End_Date is first hit when connected to backend server for both environment.

What I’ve tried and what’s not working:
What’s happening?
Dev is working fine both development UI and dev server are connecting fine and working as expected.

What’s not happening?
When trying to connect with the public link it connects published server but in UI loading happens and takes forever and no any error seen.

In UI:
After long time I got RuntimeError: Connection to server failed (1006)

In server log:
Connecting to wss://anvil.works/uplink
Anvil websocket open
Connected to “Default environment (published)” as SERVER

I tried to use exception but didn’t catch error.

Code Sample:

# code snippet

In Dev Server:
    try:
        anvil.server.connect("Key-Dev")
    except Exception as e:
        print("Problem connecting: %s" % e)


In Published Server:
    try:
        anvil.server.connect("Key")
    except Exception as e:
        print("Problem connecting: %s" % e)

Clone link:
share a copy of your app

This post may be helpful

Thanks for the reply. I saw that post but it is![Screen Shot 2021-04-20 at 1.46.29 AM|690x317] a bit different from my scenario.


In my case Anvil UI calls a method (which works on dev envt but not in published envt ) and loading takes forever and finally shows a error RuntimeError: Connection to server failed (1006)

The above post discuss about the server side connection when the server script run to connect uplink.

FYI, I have used following exception as well to track error but no any error caught.
try:
anvil.server.call(“Anvil_Get_Start_End_Date”,None)
except Exception as e:
print(“Problem connecting: %s” % e)
print(“caught an exception, now we can handle the problem in here”)