Hi all, I’ve done my fair share of reading helpful answers to good questions on this site before, but it’s my first time asking a question.
I am running into what seems like a rather niche issue while trying to deploy my Dash app onto a GKE cluster. The app is rather complicated so I will provide a simplified view of the application based on what I’ve been able to narrow down about the issue thus far.
The app has a main page container using the new built-in “dash.page_container” feature which can switch between two main pages. In one of the pages, the “design” page, I have a callback (triggered by a button) which replaces the initial page contents with a bunch of input fields. This callback works and properly updates the page state, however, afterwards none of the callbacks for these new input fields are having any effect. I am running it in debug mode and there are no errors being thrown. Additionally, I placed some print statements within a few key callbacks for debugging purposes and execution seems to flow normally, but callback return values seem to have no effect on the page elements at all.
Where it gets a little stranger is that these callbacks all work fine if I run the app locally. So I am at a loss about what could be causing these page elements not to respond to callbacks at all.
If anyone has had any similar experiences or has any ideas about what might be causing this, please let me know!
The elements are added via a regular callback which updates the page’s children utilizing a helper function. For example…
layout = dbc.Container(
dbc.Button('Build from Scratch', id='from-scratch-button'),
id='design-page-container'
)
@callback(
Output('design-page-container', 'children'),
Input('from-scratch-button', 'n_clicks'),
prevent_initial_call=True)
def load_definition_space(_):
return dbc.Row(build_input_fields())
def build_input_fields():
# this function returns a Col with lots of page elements
elements = dbc.Col(
....
)
return elements
The helper function varies certain initial fields in different cases which I left out for simplicity here.
(in this example I simplified the new page elements to be a header and a button which just appends " ;)" to the header)
Along with seeing the correct response, the header element on the page is updated as expected.
I also added another element and a callback set to update that element with the header children as an Input. Locally, there is that second _dash-update-component which reflects the correct response for that callback too.
On kubernetes, I see only that first response. It is also correct, however, the page doesn’t reflect this update.
Thanks for all your help @jinnyzor. I wanted to resolve this thread since I identified the source of the error. After much frustration trying to parse through the TypeError above, I ended up revisiting the basis debugging and found that the issue was a version mismatch between my local Dash and the one installed during container setup for my GKE deployment. This arose in this particular part of my app because I was using the new built-in page component feature that comes with Dash 2.6.0 (I believe). For some reason, this version was not being installed on GKE and simply specifying this version in my requirements.txt fixed the issue for me.