Black Lives Matter. Please consider donating to Black Girls Code today.

App crashes when hiding modebar buttons

I used the config parameter to hide modebar buttons as described here. The app loads fine locally but crashes when deployed to heroku. Sample code below, full code on GitHub.

        dcc.Graph(
            id='example-graph',
            config={
                'modeBarButtonsToRemove': ['autoScale2d', 'select2d', 'zoom2d',
                                           'pan2d', 'toggleSpikelines',
                                           'hoverCompareCartesian',
                                           'zoomOut2d', 'zoomIn2d',
                                           'hoverClosestCartesian',
                                           # 'sendDataToCloud',
                                           'resetScale2d']
            }
        )

EDIT: I noticed that the app crashes with with an empty config (modeBarButtonsToRemove commented out).

Do you have the error message?

One iteration of the Heroku log:

2018-02-21T18:50:20.726700+00:00 heroku[web.1]: State changed from crashed to starting
2018-02-21T18:50:20.686996+00:00 heroku[web.1]: Process exited with status 3
2018-02-21T18:50:35.181811+00:00 heroku[web.1]: Starting process with command gunicorn app:server
2018-02-21T18:50:39.039989+00:00 heroku[web.1]: State changed from starting to up
2018-02-21T18:50:38.142672+00:00 app[web.1]: [2018-02-21 18:50:38 +0000] [4] [INFO] Starting gunicorn 19.7.1
2018-02-21T18:50:38.143629+00:00 app[web.1]: [2018-02-21 18:50:38 +0000] [4] [INFO] Listening at: http://0.0.0.0:8788 (4)
2018-02-21T18:50:38.143788+00:00 app[web.1]: [2018-02-21 18:50:38 +0000] [4] [INFO] Using worker: sync
2018-02-21T18:50:38.191853+00:00 app[web.1]: [2018-02-21 18:50:38 +0000] [9] [INFO] Booting worker with pid: 9
2018-02-21T18:50:38.194887+00:00 app[web.1]: [2018-02-21 18:50:38 +0000] [8] [INFO] Booting worker with pid: 8
2018-02-21T18:50:49.588165+00:00 app[web.1]: [2018-02-21 18:50:49 +0000] [9] [ERROR] Exception in worker process
2018-02-21T18:50:49.588185+00:00 app[web.1]: Traceback (most recent call last):
2018-02-21T18:50:49.588187+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 578, in spawn_worker
2018-02-21T18:50:49.588189+00:00 app[web.1]: worker.init_process()
2018-02-21T18:50:49.588191+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py”, line 126, in init_process
2018-02-21T18:50:49.588192+00:00 app[web.1]: self.load_wsgi()
2018-02-21T18:50:49.588194+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py”, line 135, in load_wsgi
2018-02-21T18:50:49.588196+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-02-21T18:50:49.588198+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py”, line 67, in wsgi
2018-02-21T18:50:49.588199+00:00 app[web.1]: self.callable = self.load()
2018-02-21T18:50:49.588201+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 65, in load
2018-02-21T18:50:49.588202+00:00 app[web.1]: return self.load_wsgiapp()
2018-02-21T18:50:49.588204+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 52, in load_wsgiapp
2018-02-21T18:50:49.588206+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-02-21T18:50:49.588207+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py”, line 352, in import_app
2018-02-21T18:50:49.588209+00:00 app[web.1]: import(module)
2018-02-21T18:50:49.588211+00:00 app[web.1]: File “/app/app.py”, line 210, in
2018-02-21T18:50:49.588213+00:00 app[web.1]: dash.dependencies.Input(‘child_birth’, ‘value’)])
2018-02-21T18:50:49.588215+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/dash/dash.py”, line 527, in callback
2018-02-21T18:50:49.588217+00:00 app[web.1]: self._validate_callback(output, inputs, state, events)
2018-02-21T18:50:49.588218+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/dash/dash.py”, line 440, in _validate_callback
2018-02-21T18:50:49.588220+00:00 app[web.1]: ).replace(’ ', ‘’))
2018-02-21T18:50:49.588222+00:00 app[web.1]: dash.exceptions.NonExistantIdException:
2018-02-21T18:50:49.588223+00:00 app[web.1]: Attempting to assign a callback to the
2018-02-21T18:50:49.588225+00:00 app[web.1]: component with the id “example-graph” but no
2018-02-21T18:50:49.588226+00:00 app[web.1]: components with id “example-graph” exist in the
2018-02-21T18:50:49.588228+00:00 app[web.1]: app’s layout.
2018-02-21T18:50:49.588230+00:00 app[web.1]:
2018-02-21T18:50:49.588232+00:00 app[web.1]:
2018-02-21T18:50:49.588233+00:00 app[web.1]: Here is a list of IDs in layout:
2018-02-21T18:50:49.588235+00:00 app[web.1]: [‘mother_birth’, ‘self_birth’, ‘child_birth’]
2018-02-21T18:50:49.588237+00:00 app[web.1]:
2018-02-21T18:50:49.588238+00:00 app[web.1]:
2018-02-21T18:50:49.588240+00:00 app[web.1]: If you are assigning callbacks to components
2018-02-21T18:50:49.588241+00:00 app[web.1]: that are generated by other callbacks
2018-02-21T18:50:49.588243+00:00 app[web.1]: (and therefore not in the initial layout), then
2018-02-21T18:50:49.588245+00:00 app[web.1]: you can suppress this exception by setting
2018-02-21T18:50:49.588246+00:00 app[web.1]: app.config.supress_callback_exceptions=True.

Interesting that with the config parameter I’m getting an error about the Graph id “example-graph” not existing.

I tried adding app.config.supress_callback_exceptions=True - it still crashed with the log below.

2018-02-21T18:54:42.052334+00:00 heroku[web.1]: State changed from crashed to starting
2018-02-21T18:54:51.818791+00:00 heroku[web.1]: Starting process with command gunicorn app:server
2018-02-21T18:54:53.626107+00:00 app[web.1]: [2018-02-21 18:54:53 +0000] [4] [INFO] Starting gunicorn 19.7.1
2018-02-21T18:54:53.626780+00:00 app[web.1]: [2018-02-21 18:54:53 +0000] [4] [INFO] Listening at: http://0.0.0.0:4170 (4)
2018-02-21T18:54:53.626891+00:00 app[web.1]: [2018-02-21 18:54:53 +0000] [4] [INFO] Using worker: sync
2018-02-21T18:54:53.631017+00:00 app[web.1]: [2018-02-21 18:54:53 +0000] [8] [INFO] Booting worker with pid: 8
2018-02-21T18:54:53.725389+00:00 app[web.1]: [2018-02-21 18:54:53 +0000] [9] [INFO] Booting worker with pid: 9
2018-02-21T18:54:54.157663+00:00 heroku[web.1]: State changed from starting to up
2018-02-21T18:54:56.966519+00:00 heroku[router]: at=error code=H13 desc=“Connection closed without response” method=GET path="/" host=climate-life-events.herokuapp.com request_id=b32807db-11ca-4387-8573-97ae1c88a1f8 fwd=“128.237.212.116” dyno=web.1 connect=2ms service=1817ms status=503 bytes=0 protocol=https
2018-02-21T18:54:56.840161+00:00 app[web.1]: [2018-02-21 18:54:56 +0000] [9] [ERROR] Exception in worker process
2018-02-21T18:54:56.840191+00:00 app[web.1]: Traceback (most recent call last):
2018-02-21T18:54:56.840193+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 578, in spawn_worker
2018-02-21T18:54:56.840195+00:00 app[web.1]: worker.init_process()
2018-02-21T18:54:56.840196+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py”, line 126, in init_process
2018-02-21T18:54:56.840197+00:00 app[web.1]: self.load_wsgi()
2018-02-21T18:54:56.840198+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py”, line 135, in load_wsgi
2018-02-21T18:54:56.840200+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-02-21T18:54:56.840201+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py”, line 67, in wsgi
2018-02-21T18:54:56.840202+00:00 app[web.1]: self.callable = self.load()
2018-02-21T18:54:56.840204+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 65, in load
2018-02-21T18:54:56.840205+00:00 app[web.1]: return self.load_wsgiapp()
2018-02-21T18:54:56.840206+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 52, in load_wsgiapp
2018-02-21T18:54:56.840207+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-02-21T18:54:56.840208+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py”, line 352, in import_app
2018-02-21T18:54:56.840210+00:00 app[web.1]: import(module)
2018-02-21T18:54:56.840211+00:00 app[web.1]: File “/app/app.py”, line 157, in
2018-02-21T18:54:56.840212+00:00 app[web.1]: ‘resetScale2d’]
2018-02-21T18:54:56.840213+00:00 app[web.1]: File “”, line 35, in init
2018-02-21T18:54:56.840215+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/dash/development/base_component.py”, line 23, in init
2018-02-21T18:54:56.840216+00:00 app[web.1]: ', '.join(self._prop_names)
2018-02-21T18:54:56.840217+00:00 app[web.1]: Exception: Unexpected keyword argument config
2018-02-21T18:54:56.840218+00:00 app[web.1]: Allowed arguments: id, clickData, hoverData, selectedData, relayoutData, figure, style, animate, animation_options
2018-02-21T18:54:56.842664+00:00 app[web.1]: [2018-02-21 18:54:56 +0000] [9] [INFO] Worker exiting (pid: 9)
2018-02-21T18:54:56.849205+00:00 app[web.1]: [2018-02-21 18:54:56 +0000] [8] [ERROR] Exception in worker process
2018-02-21T18:54:56.849209+00:00 app[web.1]: Traceback (most recent call last):
2018-02-21T18:54:56.849212+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 578, in spawn_worker
2018-02-21T18:54:56.849213+00:00 app[web.1]: worker.init_process()
2018-02-21T18:54:56.849215+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py”, line 126, in init_process
2018-02-21T18:54:56.849220+00:00 app[web.1]: self.load_wsgi()
2018-02-21T18:54:56.849222+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py”, line 135, in load_wsgi
2018-02-21T18:54:56.849224+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-02-21T18:54:56.849226+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py”, line 67, in wsgi
2018-02-21T18:54:56.849227+00:00 app[web.1]: self.callable = self.load()
2018-02-21T18:54:56.849229+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 65, in load
2018-02-21T18:54:56.849231+00:00 app[web.1]: return self.load_wsgiapp()
2018-02-21T18:54:56.849232+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 52, in load_wsgiapp
2018-02-21T18:54:56.849234+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-02-21T18:54:56.849236+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py”, line 352, in import_app
2018-02-21T18:54:56.849238+00:00 app[web.1]: import(module)
2018-02-21T18:54:56.849240+00:00 app[web.1]: File “/app/app.py”, line 157, in
2018-02-21T18:54:56.849241+00:00 app[web.1]: ‘resetScale2d’]
2018-02-21T18:54:56.849243+00:00 app[web.1]: File “”, line 35, in init
2018-02-21T18:54:56.849245+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/dash/development/base_component.py”, line 23, in init
2018-02-21T18:54:56.849247+00:00 app[web.1]: ', '.join(self._prop_names)
2018-02-21T18:54:56.849249+00:00 app[web.1]: Exception: Unexpected keyword argument config
2018-02-21T18:54:56.849257+00:00 app[web.1]: Allowed arguments: id, clickData, hoverData, selectedData, relayoutData, figure, style, animate, animation_options
2018-02-21T18:54:56.851054+00:00 app[web.1]: [2018-02-21 18:54:56 +0000] [8] [INFO] Worker exiting (pid: 8)
2018-02-21T18:54:57.066021+00:00 app[web.1]: [2018-02-21 18:54:57 +0000] [4] [INFO] Shutting down: Master
2018-02-21T18:54:57.066156+00:00 app[web.1]: [2018-02-21 18:54:57 +0000] [4] [INFO] Reason: Worker failed to boot.
2018-02-21T18:54:57.217279+00:00 heroku[web.1]: Process exited with status 3
2018-02-21T18:54:57.233767+00:00 heroku[web.1]: State changed from up to crashed
2018-02-21T18:54:58.789072+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=climate-life-events.herokuapp.com request_id=6870e4eb-bbfa-40b0-b32d-c325e6dcb890 fwd=“128.237.212.116” dyno= connect= service= status=503 bytes= protocol=https

You are likely deploying an old version of dash_core_components that doesn’t yet have the config property. This was added in https://github.com/plotly/dash-core-components/blob/master/CHANGELOG.md#090---2017-07-28

F*&^^%

I copied the dash heroku template requirements.txt at the start and didn’t think about it again. Was just checking my local version. Works fine now.

Thanks for manning the forums and helping out. I like what I’m seeing from this first test of Dash and look forward to seeing it mature!