Errors after deploying a new app version

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?

Thank you!

It tough to give advice without screenshots or log messages. Can you provide any of that information?

Hello @mingw64,

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)
  • page adjustments that dont impact callbacks

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.

Thanks, this seems to be the problem. So it looks like it is part of life with dash and no simple solution for it is available?

Not sure if related, but I also get type of error quite frequently:

This is a relatively recent behavior. I can’t say for sure it started with 3.2.0, but maybe thereabout.

Traceback (most recent call last):
File "/home/ubuntu/app_name/venv/lib/python3.12/site-packages/flask/app.py", line 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/app_name/venv/lib/python3.12/site-packages/flask/app.py", line 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/app_name/venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/app_name/venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/app_name/venv/lib/python3.12/site-packages/dash/dash.py", line 1111, in serve_component_suites
_validate.validate_js_path(self.registered_paths, package_name, path_in_pkg)
File "/home/ubuntu/app_name/venv/lib/python3.12/site-packages/dash/_validate.py", line 387, in validate_js_path
raise exceptions.DependencyException(
dash.exceptions.DependencyException: "dash" is registered but the path requested is not valid.
The path requested: "dcc/sw.js"
List of registered paths: defaultdict(<class 'set'>, {'dash': {'dcc/async-graph.js.map', 'dash_table/async-highlight.js.map', 'dcc/async-slider.js', 'dcc/async-dropdown.js', 'dcc/async-highlight.js.map', 'dcc/async-datepicker.js.map', 'dcc/async-mathjax.js.map', 'dash_table/async-export.js', 'dash-renderer/build/dash_renderer.min.js.map', 'deps/polyfill@7.12.1.min.js', 'dash-renderer/build/dash_renderer.min.js', 'dash_table/async-table.js.map', 'dash_table/bundle.js', 'dcc/async-dropdown.js.map', 'dash_table/bundle.js.map', 'deps/react-dom@18.3.1.min.js', 'dcc/async-highlight.js', 'dcc/async-mathjax.js', 'deps/react@18.3.1.min.js', 'dash_table/async-export.js.map', 'dcc/dash_core_components.js', 'dcc/async-datepicker.js', 'dcc/async-upload.js', 'dcc/async-graph.js', 'dcc/dash_core_components-shared.js', 'dcc/dash_core_components-shared.js.map', 'dcc/async-slider.js.map', 'dcc/async-markdown.js.map', 'html/dash_html_components.min.js', 'deps/prop-types@15.8.1.min.js', 'dcc/async-upload.js.map', 'dash_table/async-highlight.js', 'html/dash_html_components.min.js.map', 'dash_table/async-table.js', 'dcc/async-markdown.js', 'dcc/dash_core_components.js.map'}, 'dash_bootstrap_components': {'_components/dash_bootstrap_components.min.js'}, 'dash_iconify': {'dash_iconify.min.js', 'async-DashIconify.js', 'async-DashIconify.js.map', 'dash_iconify.min.js.map'}, 'dash_cytoscape': {'dash_cytoscape.min.js'}, 'plotly': {'package_data/plotly.min.js'}})