[FIXED] The server code changes doesn't kick in on time!

It seems that the server code doesn’t keep up with the changes in server editor. I still get error messages about a code that is not there anymore!

My workaround was to save latest changes and publish the application. After that the new functions were available.

Thank you for the suggestion, however it didn’t work for me :slightly_frowning_face:

This really should be moved to its own topic.

@advancedhealthsys, after publishing, did all the users refresh their browsers? If not, then they’re still running older code.

I think it is related to the outage, I didn’t have this issue until this morning, before whenever I update the server code in the editor, the new code works when I call the server code, but now it doesn’t change, even when I publish or unpublish the app (I am still in the development phase) and refresh all the custom components!

here is an example to the updated server code:

import anvil.server
from bs4 import BeautifulSoup
import itertools
import datetime

@anvil.server.callable
def say_hello(name):
print("Hello, " + name + “!”)

@anvil.server.callable
def test():
html_doc = ‘’‘The Dormouse’s story’’’
soup = BeautifulSoup(html_doc, ‘html.parser’)
print(soup.prettify())

and this is my client code:

from ._anvil_designer import Form1Template
from anvil import *
import anvil.server

class Form1(Form1Template):

  def __init__(self, **properties):
    self.init_components(**properties)
    anvil.server.call('say_hello', "sam")
    anvil.server.call('test') 

the output when I run the app:

Hello, sam!
this is the full HTML code: 
TypeError: test() missing 1 required positional argument: 'test'
at app/test_server_issue/Form1/__init__.py, line 11 column 4

So, the changes I do in the server side doesn’t apply for some reason, please note that I am calling the server code that belong to a custom component, I never had any issue doing this until this morning!

Hi @advancedhealthsys,

Do you have a clone link you could share so we can take a look? To do this, go to the gear menu :gear: in the Anvil editor, then choose Share app and then Share your source code and data with others . (Note: Only do this if you are comfortable with everyone seeing your application, its source code and everything in its Data Tables!)

When you say your server code belongs to a custom component, do you mean the server code you’re calling is in a dependency?

Hi @bridget:

Yes

here is a copy of a test app (two apps):

https://anvil.works/build#clone:KNWH6552YHPXZNLE=5ILCRKWQWPBAP3EBEU5EWTEP

What it does now, when I update the server code in the custom component, the changes apply when I run the custom comp app, however it takes a while for these changes to appear in the app that using the custom comp. You will have to change the server code multiple times and run the app to see the issue.

Thank you for looking into this.

Hi,

Any updates? I am stuck :pensive:!

just to check do you have a published version of the dependency - if you do then the apps using the dependency will always use the published version.

Which could be the reason for old server code running in apps. If you’re developing you might wish to remove the published version.

If you need a published version and a dev version consider moving to a prod/dev approach
https://anvil.works/docs/how-to/development-production

no, it is not published, I created the above apps to show the issue. I never had this issue before 9/23/2020.

yeah - i just checked your clone and it’s as you said:
The server code in the dependency when changed doesn’t get updated in the app that’s using it.

I’d call this a bug.

1 Like

Thank you for checking. Does that happen too in your applications?

Thanks for the clone @advancedhealthsys.

I’m moving this thread to Bug Reports and we’re looking into it for you! :slight_smile:

I hope you guy can fix the issue soon, I would like to work on my app this weekend.

Any updates about when the issue while be resolved?

Hi @advancedhealthsys,

This has now been fixed :slight_smile:

Please let me know if you’re still having any issues.

3 Likes