Dash-extensions, ServerSideOutput error

Hi Emil, I just installed new dash 2.9.3 and the code doesn’t work. so frustrated, The error is shown below. any idea why it is not working for me? Thanks

nvalidCallbackReturnValue: The callback for [<ServersideOutput store.data>, <ServersideOutput time.data>]
returned a value having type DataFrame
which is not JSON serializable.

The value in question is either the only value returned,
or is in the top level of the returned list,

            and has string representation
            `       rnd

0 0.67604`

            In general, Dash properties can only be
            dash components, strings, dictionaries, numbers, None,
            or lists of those.

Hi @roudan,

Did the same callback work before installing the latest version of dash?

Are you sure you used DashProxy and ServersideOutputTransform

app = DashProxy(transforms=[ServersideOutputTransform()])

Could you post a MWE demonstrating the issue? :slight_smile:

I’m getting the same error with 2.9.2 - it used to work fine, I’m returning a list of dataclasses. I refactored the code into pages (https://dash.plotly.com/urls) and now ServersideOutput is trying to json serialise the dataset.

I figured out how to reproduce this, if you define the callback as

@dash.callback(ServersideOutput(component_id='data-store', component_property='data'),
              Input(component_id='dropdown', component_property='value'))
def load_data(id):
    pass

It produces the error, if you replace @dash.callback with @app.callback

@app.callback(ServersideOutput(component_id='data-store', component_property='data'),
              Input(component_id='dropdown', component_property='value'))
def load_data(id):
    pass

It works fine.

Yes, that is expected behavior. You must use imports from ‘dash-extensions’ (instead of ‘dash’) for the transforms to be applied. It has always been like that, there should be no changes with Dash 2.9 :slight_smile: