Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot convert undefined or null to object #127

Closed
darkkatarsis opened this issue May 29, 2019 · 10 comments
Closed

TypeError: Cannot convert undefined or null to object #127

darkkatarsis opened this issue May 29, 2019 · 10 comments
Labels
bug Something isn't working

Comments

@darkkatarsis
Copy link
Contributor

darkkatarsis commented May 29, 2019

There is a problem when mini-media-player has as source virtual entity like "media_player.spotify" from https://github.com/hassio-addons/addon-spotify-connect, other media_player sources work fine

error from the dev console on chrome:

app.a259a502.js:2 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at HTMLElement._listenKeyEventListeners (app.a259a502.js:2)
    at HTMLElement.attached (app.a259a502.js:2)
    at HTMLElement.attached (app.a259a502.js:651)
    at HTMLElement.connectedCallback (app.a259a502.js:2)
    at Va._insert (mini-media-player-bundle.js?v=1.1.3:1)
    at Va._commitNode (mini-media-player-bundle.js?v=1.1.3:1)
    at Va._commitTemplateResult (mini-media-player-bundle.js?v=1.1.3:1)
    at Va.commit (mini-media-player-bundle.js?v=1.1.3:1)
    at db (mini-media-player-bundle.js?v=1.1.3:1)
@kalkih kalkih added the bug Something isn't working label May 29, 2019
@kalkih
Copy link
Owner

kalkih commented May 29, 2019

Hello, I'm not familiar with that particular addon.
Are you using the spotify component and get the error when spotify has hass.io as source?

Could you post the attributes of the media player when you are seeing this issue, thanks.

Also, is that the entire error? there's no down arrow you can press to get a longer stack trace?

@darkkatarsis
Copy link
Contributor Author

darkkatarsis commented May 29, 2019

Thank you for the quick reply. Exactly, Im using this spotify component

configuration.yaml

media_player:
  - platform: spotify
    client_id: !secret spotify_id
    client_secret: !secret spotify_token

lovelace.yaml

type: vertical-stack
show_header_toggle: false
title: Music
cards:
  - type: 'custom:mini-media-player'
    entity: media_player.spotify
    group: false
    icon: 'mdi:spotify'
    shortcuts:
      columns: 3
      hide_when_off: true
      spotify_source:
        name: 'Source:'
        options:
          - option1
          - option2

after changing entity: media_player.spotify to something else the problem disappears

error from console:
img

@iantrich
Copy link
Contributor

@darkkatarsis if you go to the developer states page, you'll find the listed attributes for any of your devices which is what @kalkih is asking be provided

image

@darkkatarsis
Copy link
Contributor Author

darkkatarsis commented May 29, 2019

@iantrich, @kalkih

Entity:
media_player.spotify

State:
idle

Attributes:

media_content_type: music
source_list: MIBOX3
shuffle: false
friendly_name: Spotify
icon: mdi:spotify
supported_features: 51765

@kalkih
Copy link
Owner

kalkih commented May 29, 2019

Thanks, umm, actually not sure, the error in the screenshot you posted has a different stack trace.
I'm actually able to reproduce similar errors by jumping between views, but these does only trace back to app*.js and chunk*.js.

@iantrich Any idea what this could be?

app.7ac4ac3c.js:2 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at HTMLElement._listenKeyEventListeners (app.7ac4ac3c.js:2)
    at HTMLElement.attached (app.7ac4ac3c.js:2)
    at HTMLElement.attached (app.7ac4ac3c.js:651)
    at HTMLElement.connectedCallback (app.7ac4ac3c.js:2)
    at HTMLElement.value (chunk.02296e9bfeb8fa5abc3e.js:5864)
    at HTMLElement.value (chunk.02296e9bfeb8fa5abc3e.js:5864)
    at HTMLElement.performUpdate (app.7ac4ac3c.js:2)
    at HTMLElement._enqueueUpdate (app.7ac4ac3c.js:2)
_listenKeyEventListeners @ app.7ac4ac3c.js:2
attached @ app.7ac4ac3c.js:2
attached @ app.7ac4ac3c.js:651
connectedCallback @ app.7ac4ac3c.js:2
value @ chunk.02296e9bfeb8fa5abc3e.js:5864
value @ chunk.02296e9bfeb8fa5abc3e.js:5864
performUpdate @ app.7ac4ac3c.js:2
_enqueueUpdate @ app.7ac4ac3c.js:2
async function (async)
_enqueueUpdate @ app.7ac4ac3c.js:2
_requestUpdate @ app.7ac4ac3c.js:2
set @ app.7ac4ac3c.js:2
commit @ app.7ac4ac3c.js:2
commit @ app.7ac4ac3c.js:2
update @ app.7ac4ac3c.js:2
_commitTemplateResult @ app.7ac4ac3c.js:2
commit @ app.7ac4ac3c.js:2
a @ app.7ac4ac3c.js:2
U.render @ app.7ac4ac3c.js:2
update @ app.7ac4ac3c.js:2
performUpdate @ app.7ac4ac3c.js:2
_enqueueUpdate @ app.7ac4ac3c.js:2
async function (async)
_enqueueUpdate @ app.7ac4ac3c.js:2
_requestUpdate @ app.7ac4ac3c.js:2
set @ app.7ac4ac3c.js:2
value @ app.7ac4ac3c.js:1197
value @ app.7ac4ac3c.js:881
performUpdate @ app.7ac4ac3c.js:2
_enqueueUpdate @ app.7ac4ac3c.js:2
async function (async)
_enqueueUpdate @ app.7ac4ac3c.js:2
_requestUpdate @ app.7ac4ac3c.js:2
set @ app.7ac4ac3c.js:2
commit @ app.7ac4ac3c.js:2
commit @ app.7ac4ac3c.js:2
update @ app.7ac4ac3c.js:2
_commitTemplateResult @ app.7ac4ac3c.js:2
commit @ app.7ac4ac3c.js:2
a @ app.7ac4ac3c.js:2
U.render @ app.7ac4ac3c.js:2
update @ app.7ac4ac3c.js:2
performUpdate @ app.7ac4ac3c.js:2
_enqueueUpdate @ app.7ac4ac3c.js:2
async function (async)
_enqueueUpdate @ app.7ac4ac3c.js:2
_requestUpdate @ app.7ac4ac3c.js:2
set @ app.7ac4ac3c.js:2
commit @ app.7ac4ac3c.js:2
commit @ app.7ac4ac3c.js:2
update @ app.7ac4ac3c.js:2
_commitTemplateResult @ app.7ac4ac3c.js:2
commit @ app.7ac4ac3c.js:2
update @ app.7ac4ac3c.js:2
_commitTemplateResult @ app.7ac4ac3c.js:2
commit @ app.7ac4ac3c.js:2
a @ app.7ac4ac3c.js:2
U.render @ app.7ac4ac3c.js:2
update @ app.7ac4ac3c.js:2
performUpdate @ app.7ac4ac3c.js:2
_enqueueUpdate @ app.7ac4ac3c.js:2
async function (async)
_enqueueUpdate @ app.7ac4ac3c.js:2
_requestUpdate @ app.7ac4ac3c.js:2
set @ app.7ac4ac3c.js:2
value @ app.7ac4ac3c.js:1272
handleEvent @ app.7ac4ac3c.js:2
_boundHandleEvent @ app.7ac4ac3c.js:2
S @ app.7ac4ac3c.js:2
j @ app.7ac4ac3c.js:2
k @ app.7ac4ac3c.js:2
(anonymous) @ app.7ac4ac3c.js:2
_propertiesChanged @ app.7ac4ac3c.js:2
_flushProperties @ app.7ac4ac3c.js:410
_flushProperties @ app.7ac4ac3c.js:2
_invalidateProperties @ app.7ac4ac3c.js:2
_setProperty @ app.7ac4ac3c.js:2
Object.defineProperty.set @ app.7ac4ac3c.js:410
_locationChanged @ app.7ac4ac3c.js:1033
z @ app.7ac4ac3c.js:2
k @ app.7ac4ac3c.js:2
w @ app.7ac4ac3c.js:2
_propertiesChanged @ app.7ac4ac3c.js:2
_flushProperties @ app.7ac4ac3c.js:410
_flushProperties @ app.7ac4ac3c.js:2
_invalidateProperties @ app.7ac4ac3c.js:2
_setProperty @ app.7ac4ac3c.js:2
Object.defineProperty.set @ app.7ac4ac3c.js:410
__computeRoutePath @ app.7ac4ac3c.js:1038
z @ app.7ac4ac3c.js:2
k @ app.7ac4ac3c.js:2
w @ app.7ac4ac3c.js:2
_propertiesChanged @ app.7ac4ac3c.js:2
_flushProperties @ app.7ac4ac3c.js:410
_flushProperties @ app.7ac4ac3c.js:2
_invalidateProperties @ app.7ac4ac3c.js:2
(anonymous) @ app.7ac4ac3c.js:2
_propertiesChanged @ app.7ac4ac3c.js:2
_flushProperties @ app.7ac4ac3c.js:410
_flushProperties @ app.7ac4ac3c.js:2
_invalidateProperties @ app.7ac4ac3c.js:2
_setProperty @ app.7ac4ac3c.js:2
Object.defineProperty.set @ app.7ac4ac3c.js:410
_urlChanged @ app.7ac4ac3c.js:1033
(anonymous) @ app.7ac4ac3c.js:2
r @ app.7ac4ac3c.js:2
i @ app.7ac4ac3c.js:806
value @ chunk.02296e9bfeb8fa5abc3e.js:5864
handleEvent @ app.7ac4ac3c.js:2
_boundHandleEvent @ app.7ac4ac3c.js:2
fire @ app.7ac4ac3c.js:2
_itemActivate @ chunk.46f96511e93e506b8f33.js:2
_activateHandler @ chunk.46f96511e93e506b8f33.js:2
_activateHandler @ chunk.46f96511e93e506b8f33.js:2
_activateHandler @ chunk.02296e9bfeb8fa5abc3e.js:2506
(anonymous) @ app.7ac4ac3c.js:2
H @ app.7ac4ac3c.js:2
V @ app.7ac4ac3c.js:2
touchend @ app.7ac4ac3c.js:2
I @ app.7ac4ac3c.js:2

@kalkih
Copy link
Owner

kalkih commented May 29, 2019

Maybe related home-assistant/frontend#3125

@darkkatarsis
Copy link
Contributor Author

if I can add jumping between views, reloading page and editing card reproduce this error

@nudded
Copy link

nudded commented Jun 9, 2019

@kalkih I did some investigation and it's related to the ha-paper-slider. It seems like the registered callback is not called, which causes _keyBindings to be empty. In other places ha-slider is used, which does not have this problem.

There is also this https://github.com/home-assistant/home-assistant-polymer/blob/dev/hassio/src/hassio-main.ts#L33 interesting comment, which seems like an ugly work-around for the same problem.

@kalkih
Copy link
Owner

kalkih commented Jun 14, 2019

Thanks @nudded, switching to ha-slider seems to indeed prevent these errors. the ha-slider component was introduced sometime in december last year so changing to it would make the card incompatible with HA versions prior to ~ 0.85.0, but we could add a check and define it if it doesn't exist.

kalkih added a commit that referenced this issue Jun 14, 2019
@nudded
Copy link

nudded commented Jun 15, 2019

@kalkih Ah very nice, thanks for taking the time to fix it! (although I guess it is also an issue upstream)

@kalkih kalkih closed this as completed Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants