Callbaks Not responding in Google Kubernetes Deployment

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!

Hello @ayhan,

Welcome to the community!

How are these elements added? Via a regular callback or a clientside callback?

Have you tried opening your app locally in incognito mode? You could be missing a key component that your regular browser already has.

Thanks for the quick response!

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.

The app runs fine locally in incognito mode.

How are the other callbacks triggering, to the outputs?

When using the browser and accessing the Kubernetes, what does your response look like from the post request?

This will be in the developer interface on your browser within the network tab:

Look for a request to _dash-update-component that lines up when you are triggering the other callbacks.

Check the response object for the expected information.

2 Likes

This is a great debugging method I didn’t realize was possible!

I tested this out both locally and on Kubernetes. Locally, it behaved as expected…


(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.


Also, notably there is no _dash-update-component trigger for the second callback, indicating that the output element is never actually updated.

2 Likes

Hmm, strange.

Is there a console error when it is trying to update the component?

yes actually, here is what I see…

3 Likes

And now you know where the error is. :slight_smile:

Click on that link and you’ll see what is happening.

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.

1 Like