Anvil Community Forum

[BETA] Uplink issues today?

What I’m trying to do:
Connect my uplink code to my app. This code was working perfectly yesterday, but from late this afternoon my app seems to have stopped communicating with it.

What I’ve tried and what’s not working:
My uplink code seems to connect. The key is correct and it shows this :

Connecting to wss://
Anvil websocket open
Connected to "Default environment" as SERVER

However, when I try to call a function defined in the uplink scripts I get this exception :
but the uplink code is still running. No errors get displayed uplink side.

Code Sample:

# this is the complete uplink script with the key redacted.
import anvil.server
import auth
import suppliers
import resellers
import smpp_clients
import http_clients

from class_mysql_official import MySQL


No errors get displayed uplink side, but none of the functions defined in the imported modules register, either.

The code has been unaltered for days and worked perfectly well until today.

How can I tell what is going on? Where is the uplink connecting to if not the app with the matching key?

Quite critical for me, as most of my apps reply heavily on uplink …

edit - I think I see the issue. The uplink only seems to work to the MASTER branch, whereas I’m editing MAIN-DEV branch.

Can I make the uplink communicate to a different branch? I don’t really want to merge this code yet to the master.

Ok, I found how to change it (under publishing), now the uplink works again after adding a new environment (and converting my project to use environments) …

something must have changed - this was working fine yesterday. I need to know for my sanity if you made an update today please. If not, then something else is wrong.

EDIT 3 - it’s stopped working again. Same issue as before. It started working after my environment change above, but then stopped without me editing a single file.

This is driving me mad. It’s now working 10% of the time. No errors uplink side. Same action in the app (show a list of data from a sql table). Keep clicking the button and some of the time it will return the result, most it will return the uplink disconnected exception. The app is running in the IDE.

Right, if I go to the private URL, it works every time, but from inside the IDE it fails around 30% of the time. It’s like the IDE is getting confused over which environment to use?

Problem is, I don’t know what to look for.

Have you looked at this?

I had this checked and when I was testing a function on the dev environment on my pc, my pc was getting all the calls to the prod environment.
But only while I was testing.
So I would notice something wrong in production, drop whatever test I was doing, tried to figure out what was wrong, without thinking whether my pc was running and registering those functions…
That was a long day.

Mine is checked too, but I think that’s what I want? My app is only in dev at the moment, so I want to be sure I’m only calling the one uplink.

What’s odd is that if I sit there clicking a button that makes one server call defined in the uplink, it will work properly one time in 3 or 4 but the rest of the time it will throw an exception.

If I publish my dev branch and access the URL, then it works perfectly every time I click the button.

Any thoughts on what might cause that? I’m sure it must be an environment based issue, I just can’t see what or why one in X times work - surely it should always work or always fail?

If that checkbox is checked, then the calls to the functions registered in the uplink module will go to the uplink module and the functions with the same name defined in another uplink or a server module will be ignored.

So your production environment is already using that code.

In my case I had the production slowing down a lot and failing randomly. It was slower because functions that are usually running on the server were running on my pc. It was failing randomly because I was running a module under development that often had something broken (see here)

The next day (or minute) I created this feature request.

Are you able to change the name of the functions registered in the dev environment?
And remove the decorator from all the functions that you are not using?

Getting late now and I’m tired, probably better I pick this up in the morning, but …

I don’t think my issue is the same. When mine fails it throws the UplinkDisconnected exception rather than giving me different return results. Yet as far as I can tell the uplink script remains running (and there’s definitely no uplink script running anywhere else - this app has not made it off my laptop yet). When it works I get my debug from the uplink script on my terminal, so I know the “working” arm of this test is running on the server I expect it to run on.

Can’t see the wood for the trees now. Thanks @stefano.menci but I need to rest my brain for tonight…

I’m absolutely stumped as to what to do. At the moment I have to publish to test, which is inconvenient and makes debugging the front end much harder.

To summarise the issue - I call the same uplink function repeatedly by clicking a button, and 2 calls in 3 to my uplink code fail with an UplinkDisconnected exception. The successful call works as expected. At no point does my uplink script terminate or throw any errors, at least not in any visual way.

The published app works fine every time, so I strongly suspect this is an environment thing, but as to what I’ve no idea.

edit - I have now deactivated the uplink in the IDE for this app, and it STILL works one time in three. So this is definitely an environment thing. But I can’t see where…

edit 2 - if I uncheck the “send server calls from other environments…” then the published version works every time and the dev version fails every time. Not sure what this means…

I am editing “main-dev” and this is the published branch -

The uplink is connecting to

Connected to "Published" as SERVER
and the uplink is set up in the “main-dev” environment :

(I’ve regenerated the key :slight_smile: )

So with the above (unchecked) the IDE fails every time and the published version works every time. If I check that box, the IDE works 1 time in 3. No other environment has the uplink enabled.

Ok, I unpublished the main-dev branch and generated a private link (so I could enable uplink). Now the IDE version works every time. It’s also connecting to debug instead of production :
Connected to "Debug for" as SERVER

So it looks like it fails 1 time in X if I have a publicly published branch. Surely that can’t be right?

edit - thanks @daviesian for the email regarding this. I’ll let you know if it happens again.

Hi folks,

We have now found and fixed an issue in our infrastructure that we believe was causing all the Uplink-related problems reported over the last few days. A (very) brief outage in our database system earlier in the week had left some server nodes with stale records of connected Uplinks, so those nodes thought they had Uplinks connected when they didn’t. This meant that some proportion of calls to functions defined in Uplink scripts were routed to incorrect nodes and failed with an UplinkDisconnectedError.

The stale records have now been cleaned up, so the issue should be completely resolved. Please let us know if you see any further problems. We will, of course, be developing and shipping updates to the Anvil platform to prevent this from happening again.

Thanks for your patience while we investigated and fixed this, and thanks in particular to @david.wylie, @stone.john and @mreynold for their help with pinpointing and reproducing the problem.


Hello @daviesian,

I am having the same issue today.