Uplink stopped working for app

I am connecting a server uplink from my laptop to my anvil app. The uplink IDs match and I have only one environment (the default one I am developing with).

The uplink says it’s connected, but cannot see any of the functions defined in the app.

If the app tries to call a function on the uplink, I get the spinney thing and no further.

This is new.

Ok, it’s started working again.

Are you guys (Anvil Central) updating things at the moment? If so then that would explain it, but if not then this problem is probably still there.

edit - ah, I’m guessing you are updating things because my other issue looks like it’s fixed as well Spoke too soon - other problem not fixed.

Hi @david.wylie – we weren’t doing any Uplink-specific maintenance, and so while I’m glad this was resolved it would be good to have a little more information:

  • When you say “The uplink says it’s connected, but cannot see any of the functions defined in the app”, what do you mean by “cannot see”? When you anvil.server.call() a function that’s defined in a Server Module (or another Uplink), what happens?

  • When you say “If the app tries to call a function on the uplink, I get the spinney thing and no further”, are you running this in the dev environment (ie in the IDE), or a published URL, or does it happen on both?

Please let us know again if this recurs!

Hi - rereading my post I was a little vague. Typical of my typing whilst thinking instead of thinking what I’m typing …

So, when the uplink script tried to call a server function in the Anvil hosted app, I got this :

$ python numberdealer_v3_uplink.py 
Connecting to wss://anvil.works/uplink
Anvil websocket open
Connected to "Private link to branch master" as SERVER
<redacted - I printed my uplink key>
Traceback (most recent call last):
  File "/home/user/Documents/dev/NumberDealer V3/.venv/lib/python3.12/site-packages/anvil/server.py", line 411, in call
    return _do_call(args, kwargs, fn_name=fn_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/Documents/dev/NumberDealer V3/.venv/lib/python3.12/site-packages/anvil/server.py", line 401, in _do_call
    return _threaded_server.do_call(args, kwargs, fn_name=fn_name, live_object=live_object)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/Documents/dev/NumberDealer V3/.venv/lib/python3.12/site-packages/anvil/_threaded_server.py", line 436, in do_call
    raise error_from_server
anvil._server.NoServerFunctionError: No server function matching "aaaaa" has been registered

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/Documents/dev/NumberDealer V3/python_code/numberdealer_v3_uplink.py", line 50, in <module>
    print(anvil.server.call("aaaaa"))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/Documents/dev/NumberDealer V3/.venv/lib/python3.12/site-packages/anvil/server.py", line 414, in call
    raise _server._deserialise_exception(e.error_obj)
anvil._server.NoServerFunctionError: No server function matching "aaaaa" has been registered

The main app had this definition :

@anvil.server.callable
def aaaaa():
    return "hello"

The uplink code had this (snippet) :

import anvil.server
import os
import id_factory
import login

anvil.server.connect(os.environ.get('ND3_UPLINK_SERVER_KEY', ''))

print (os.environ.get('ND3_UPLINK_SERVER_KEY', ''))

from portable_classes import Response


@anvil.server.callable
def authenticate_user(**kwargs):
    auth = login.LoginDatabase("../databases/logins.db")
    return auth.authenticate(kwargs.get("username", None), kwargs.get("password", None))


@anvil.server.callable
def uplink_ping(**kwargs):
    print("in ping")
    return "pong"

and the main app was doing :

try:
    print("hello 1")
    ret = anvil.server.call("uplink_ping")
    print("hello 2")
except Exception as e:
    print("failed")

“hello 1” got printed, “hello 2” did not, and all I saw was the spinney thing.

The anvil main app was running in the IDE. The app is not published yet.

Hope that helps?

1 Like

I’m not sure if this helps but does adding the below at the end of your uplink code help?

anvil.server.wait_forever()

My bad - it is there, it just got truncated when I copied/pasted the code.