I run my dash app on an AWS EC2, on 3 gunicorn workers. Logs are sent to CloudWatch.
I noticed that whenever I deploy a new version that has some changes in the callback inputs/outputs, I get a bunch of errors sporadically, usually over a few hours to a couple days.
The errors are always dash exceptions, not something specific in my code. I don’t remember the precise text now, but often it is about missing/mismatching callback signatures.
A few times I saw this happen live. I opened the app on my phone and for some reason it wasn’t behaving well. After refreshing the page everything was fine. Then looking at CloudWatch, I saw that there were errors at the exact same time.
In short, it looks like the client side part of Dash didn’t refresh and is mismatched with the “backend”. I’m sure you guys have a more specific explanation.
Is this a familiar issue? Is there a way to “force” a refresh or some other solutions to avoid this UX on every app update?
If there are issues or major changes, you can always add a version test to your app. You can use a before_request or use an interval to test for the version.
If the version can update without needing to refresh the page, then you can have a flag that doesnt require the app to reload.
If the version however does require a front-end update, eg Callbacks added / removed, clientside callback updated, you can send a nice front-end notification telling the user to refresh the page as they have an outdated version.
Things that would require a refresh:
callbacks added / removed
clientside callbacks
adjusting the app layout
adding pages
many more
Things that shouldnt require a refresh:
server side callback modifications (not changing inputs and output components)
Thanks @jinnyzor .
I’m also adding some feedback that my colleague, Emily, had.
If you’re leaving the browser window open and not refreshing it after you deploy a new version, the existing window might be using the old JavaScript from the previous version. That would cause the frontend and backend to get out of sync. For example, the frontend is still sending requests using the old callback signatures, but the backend is expecting the new callback signatures.