500 Server Error when accessing dashboards

I recently went through a process of moving HASS and appdaemon/hadashboard from a Pi to a PC. In the process, I upgraded all of the components to the latest versions. It took some time but I got almost everything working. However, even though my automation with appdaemon is working again, I cen’t get any dashboards to work. They all return a “500 Server Error”. If I navigate to the http://hass:5050 page, I get the list of dashboards. However, If I select any of them, I get the 500 error.

I created a hello world dashboard I called test to use to troubleshoot:

title: Hello Panel
widget_dimensions: [120, 120]
widget_margins: [5, 5]
columns: 8

label:
    widget_type: label
    text: Hello World

layout:
    - label(2x2)

It gets the 500 error like the others I brought over from the pi.

When I get the error, there are no new entries in the appdaemon log, the appdaemon error log, or the home assistant log.

I reviewed the hadashboard topics that referenced “500 Server Error” but most of them were from over a year ago and the solutions included waiting for the new version of appdaemon that Andrew was working on, to checking persmissions on files (which I have). I, of course, have the latest version (On the old Pi, I made homeassistant (user and group) the owner of all of the files and I have done that on the new, PC-based system.

Here is an appdaemon log excerpt from a restart:

2019-04-24 12:56:11.548847 INFO AppDaemon Version 3.0.2 starting
2019-04-24 12:56:11.549088 INFO Configuration read from: /home/homeassistant/.appdaemon/appdaemon.yaml
2019-04-24 12:56:11.550341 INFO AppDaemon: Starting Apps
2019-04-24 12:56:11.550586 WARNING config_dir: /home exists, but is not writeable, owner: root
2019-04-24 12:56:11.552636 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-04-24 12:56:11.588326 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-04-24 12:56:11.588458 WARNING AppDaemon: HASS: ha_key is deprecated please use HASS Long Lived Tokens instead
2019-04-24 12:56:11.588641 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-04-24 12:56:11.588766 INFO Starting Dashboards
2019-04-24 12:56:11.592105 INFO Starting API
2019-04-24 12:56:11.597567 INFO AppDaemon: HASS: Connected to Home Assistant 0.90.2
2019-04-24 12:56:11.650995 INFO AppDaemon: Got initial state from namespace default
2019-04-24 12:56:13.634140 INFO AppDaemon: Reading config
2019-04-24 12:56:13.651574 INFO AppDaemon: /home/homeassistant/.appdaemon/apps/apps.yaml added or modified
2019-04-24 12:56:13.651652 INFO AppDaemon: /home/homeassistant/.appdaemon/apps/apps.yaml added or modified

I dug into the config_dir warning but can’t figure out what’s wrong. The /home directory is owned by root:root on both the old and new systems and the permissions are 755 on both systems. Below that, the homeassistant and home assistant/.appdaemon directories have the same ownership and permissions.

Are there other places to look to get some hints on what is wrong?

Please post your appdaemon.yaml file so we can have a look. If you haven´t already, add all the logging options to the appdaemon.yaml file to see if you get any more info in the log files:

log:
  accessfile: /home/appdaemon/logs/access.log
  errorfile: /home/appdaemon/logs/error.log
  logfile: /home/appdaemon/logs/appdaemon.log
  diagfile: /home/appdaemon/logs/diag.log

Adjust the paths to where you want the log files.

I had not looked at the access.log file which was configured in my appdaemon.yaml file. It held the clue:

2019-04-25 10:21:17.404328 WARNING ------------------------------------------------------------
2019-04-25 10:21:17.404402 INFO function [get_dashboard] finished in 97 ms
2019-04-25 10:23:51.303221 INFO Compiling dashboard 'test'
2019-04-25 10:23:51.396408 WARNING ------------------------------------------------------------
2019-04-25 10:23:51.396495 WARNING Unexpected error during DASH creation
2019-04-25 10:23:51.396548 WARNING ------------------------------------------------------------
2019-04-25 10:23:51.396680 WARNING Traceback (most recent call last):
  File "/srv/appdaemon/lib/python3.6/site-packages/appdaemon/dashboard.py", line 818, in get_dashboard
    dash = self._conditional_compile(name, skin, recompile)
  File "/srv/appdaemon/lib/python3.6/site-packages/appdaemon/dashboard.py", line 770, in _conditional_compile
    dash = self._get_dash(name, skin, skindir)
  File "/srv/appdaemon/lib/python3.6/site-packages/appdaemon/dashboard.py", line 659, in _get_dash
    with open(js_path, "w") as js_file:
PermissionError: [Errno 13] Permission denied: '/home/homeassistant/.appdaemon/compiled/javascript/application.js'

Somehow, I managed to get some files in the compiled directory set up with root:root ownership. After fixing that, the problem disappeared. Thanks for the help.

1 Like