Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

App errors on setting change

ANSWERED

Hi All,

 

I have followed the settings guide as shown on https://dev.fitbit.com/guides/settings/ and every time  I change a colour in the companion app I get the following error in the console:

 

TypeError: undefined is not an object (evaluating 'evt.data.key')
onchange at companion/index.js:10

A screenshot of my companion index.js is below:

 

index.jpg

as you can see, I added some console logs to see check the code was being called. Prior to me adding lines 9 and 10, the same error occurred on line 11.

 

Any ideas?

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

ok, so after much playing around the following seems to work:

 

 console.log(evt.key + " - " + evt.newValue);

1.jpg

 

although now I am getting all kinds of other errors. I will persevere ...

View best answer in original post

Best Answer
0 Votes
8 REPLIES 8

Can you try:

console.log(JSON.stringify(evt.data))

Then see what you're receiving.

Best Answer
0 Votes

Hi Jon

 

Console says :

1.jpg2.jpg

Best Answer
0 Votes

Not sure if this makes a difference but I have configured this as an app (not a clock face) 

Best Answer
0 Votes

Apps and clocks are the same, but you can only have 1 clock and clocks can't use buttons.

 

What happens if you log the contents of evt?

 

console.log(JSON.stringify(evt))
Best Answer
0 Votes

Similar error but empty braces this time:

1.jpg

 

2.jpg

Best Answer
0 Votes

Very strange, can I see your settings.jsx?

Best Answer
0 Votes

3.jpg

 

Here you are

Best Answer
0 Votes

ok, so after much playing around the following seems to work:

 

 console.log(evt.key + " - " + evt.newValue);

1.jpg

 

although now I am getting all kinds of other errors. I will persevere ...

Best Answer
0 Votes