AppOfflineError: Connection to server failed (1006)

What I’m trying to do:
Use anvil.server.call

What I’ve tried and what’s not working:
anvil.server.call sometimes results in AppOfflineError: Connection to server failed (1006) randomly, without any clues as to why it happens. I use try except and sleep(10) before making another 5 server calls within 50 seconds. Sometimes it works, sometimes doesn’t.

I checked out the following links as well, but still now find the solution. Any help is greatly appreciated.:

1 Like

Well… that’s how it should work.

The AppOfflineError part could mean that the Anvil server is down.
The Connection to server failed part could mean that the client can’t reach the server.

Usually, when you get this error, there is a connection problem, it has nothing to do with Anvil.

The connection between the client and the server hops many times and there are many points of failure.

Perhaps Anvil could do better to improve the description of the error in some cases, but when you deal with long distance (and also short distance) connections, you always need to manage the random failures, because you will always have random failures.

1 Like

Thanks so much for the insight, @stefano.menci.

What I really dont understand is that there is still the error even making 5 consecutive calls within 50 secs and the data is not sent back to the server at all.

Could be a connection problem that lasts longer than 50 seconds?
Are you having problems only with the running app or also with the IDE?
Are you having problems with all the instances of the app or one client works and one doesn’t (especially if the 2 clients are in two different cities/states/continents)?

It happens randomly with all of my clients. There is only one common, a particular server call with some data

I guess, server is not down as other server call works well during that time.

Thanks for the conversation. I think I need to do some more test to find the root cause.

I am in the same situation, it is in a single server call that uploads media to my server.

My best guess is the amount of data getting sent requires a longer sustained connection then the average server call.

8 posts were split to a new topic: AppOffline firefox devtools responsive mode

Hello,

I am having the same problem sometime. To be honest I am worried about the error between Anvil and (1006) is something else to deal outside Anvil , I use Uplink and the function continues but the client sees AppOfflineError: App is offline

AppOfflineError: Connection to server failed (1006)
at AddComponent, line 56
AppOfflineError: App is offline
at anvil-services/anvil/users/__init__.py, line 83
called from anvil-services/anvil/users/__init__.py, line 83
called from AddComponent, line 68 ``` 

I also tried the code below from forum to increase time out, but also this function is listed in the error above

def timer_1_tick...

@anvil.server.callable
def ping():
  return "pong" ``` 

The error AppOfflineError: Connection to server failed (1006) can cause to Anvil error AppOfflineError: App is offline?

Thanks,
Besar