✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

H10 Error when Deploying a Bootswatch themed Python Dash App

Hi,

I have been struggling to deploy my app.py to Heroku, despite looking at several other issues/solutions people have posted. My app works great on my local computer, but immediately crashes on Heroku. I’m not even sure what the Heroku log is telling me:

Heroku Log:

2020-02-20T00:16:22.232722+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/json/encoder.py", line 180, in default
2020-02-20T00:16:22.232723+00:00 app[web.1]:     o.__class__.__name__)
2020-02-20T00:16:22.232732+00:00 app[web.1]: TypeError: Object of type 'int64' is not JSON serializable
2020-02-20T00:16:22.232840+00:00 app[web.1]: [2020-02-20 00:16:22 +0000] [12] [INFO] Worker exiting (pid: 12)
2020-02-20T00:16:22.334799+00:00 app[web.1]: [2020-02-20 00:16:22 +0000] [4] [INFO] Shutting down: Master
2020-02-20T00:16:22.334960+00:00 app[web.1]: [2020-02-20 00:16:22 +0000] [4] [INFO] Reason: Worker failed to boot.
2020-02-20T00:16:22.432262+00:00 heroku[web.1]: State changed from up to crashed
2020-02-20T00:16:22.415916+00:00 heroku[web.1]: Process exited with status 3
2020-02-20T00:16:29.000000+00:00 app[api]: Build succeeded
2020-02-20T00:17:27.623079+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=heart-disease-dashboard.herokuapp.com request_id=6feb01e5-5390-4f0e-b652-05d54a5cb4e5 fwd="128.189.119.61" dyno= connect= service= status=503 bytes= protocol=https

My Procfile contains: web: gunicorn app:server and I do have server = app.server in my app.py

Here is my requirements.txt contents:

pandas==0.25.3
altair==3.2.0
numpy==1.17.4
dash==1.6.1
gunicorn==20.0.0
dash-core-components==1.5.1
dash-html-components==1.0.2
dash-bootstrap-components==0.7.2
vega_datasets==0.7.0

Not sure if this is relevant, but I am using a Bootswatch theme: app = dash.Dash(__name__, external_stylesheets=[dbc.themes.FLATLY]) (https://bootswatch.com/flatly/)

Would love some insight into what the log is telling me and how to potentially fix my issue.

Thanks.

This means that you have some data somewhere (probably in your app.layout, perhaps in a graph or in a table) that is of type int64. Unfortunately, Dash doesn’t support that data type and so the app is crashing when it tries to convert that data type to JSON behind the scenes (JSON is the text format that is used to communicate between the backend and the frontend).

Thanks, that makes a lot of sense and my problem is now fixed!