[Beta] Inconsistent behavior calling a server function from the server console

Just in case you landed here and you are looking for a reason why calling the same server function would return two different results, here is why it was happening to me.

The problem was caused by two things happening at the same time:

  • I had an uplink script running on my computer that was registering a function with the same name
  • I had the Run scheduled tasks in this environment checked in the development environment (publish - environment - show advanced options - uplink keys)

ServerModule.get_releases() calls the function defined on the selected environment running on the server.

anvil.server.call('get_releases') calls the function registered by the uplink script, regardless of the selected environment.

In addition to this, which was already spooky enough, I was running that uplink only while running tests or debugging, so sometime the script was there and sometimes it wasn’t.

(Thanks @ian, I wouldn’t have figured it out by myself).

2 Likes