anvil.server.NoServerFunctionError: No server function matching "***" has been registered

What I’m trying to do:
Test some custom logging functionality I have added. To do this I created a test server module and try execute the test with a button in the ui.

What I’ve tried and what’s not working:
I have a button on the front end that I press to test this it does this

anvil.server.call('test_all_logging')

I have done this process a lot of times before without issue.

Code Sample:

@anvil.server.callable
def test_all_logging():
    pass

The error I get exactly is

anvil.server.NoServerFunctionError: No server function matching "test_all_logging" has been registered

Not sure how it is possible that the function is not registered. The code that is in the frontend and the decorator were both autocompleted making me doubt it was a typo.

This is the first time I’m using a branch that is not master to develop but I can’t imagine that is related. OR could the REPL be running master? I’m doing all the testing in my debug env but that’s what I always do too.

I feel like this will be something remarkably simple…

Thanks in advance

Some things to check:

  • Is the callable really in a file under Server Code?
  • Is import anvil.server anywhere above the callable?
  • Does the module have any code (a module-level if or return) that would prevent the interpreter from executing the def statement?
1 Like

Thanks for responding.

It is definitely in a server module, here’s the code exactly as is (pass was put there to try narrow down where the issue is):

import anvil.google.auth, anvil.google.drive, anvil.google.mail
from anvil.google.drive import app_files
import anvil.email
import anvil.files
from anvil.files import data_files
import anvil.secrets
import anvil.users
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
import anvil.server


@anvil.server.callable
def test_all_logging():
    pass

Try to change the name and make it not starting with test_ or ending with _test (you shouldn’t have any testing frameworks around, but just in case, some testing frameworks may kidnap those functions).

Try to set the name in the decorator with @anvil.server.callable('some_new_name')

2 Likes

Thanks for responding.

I changed both the server and front end code to have the name “tes_all_logging1” now

The issue persists. Super strange. Wish I could give a clone link but unfortunately there’s confidential information in there.

Happy to send whatever else needs sending.

In the end I just deleted the simple module and recreated it and it seemed fine. Bizarre bug.