googlefitbit icon indicating copy to clipboard operation
googlefitbit copied to clipboard

dataset from undefined

Open choce001 opened this issue 8 years ago • 12 comments

Hello, I tried intraday and interday and they worked very weel but whenI run the intraday_all I got this message "TypeError: Unable to read dataset property from undefined" any idea ? Thanks by advance

choce001 avatar Dec 14 '17 13:12 choce001

I'm running into this same issue.

rileym94 avatar Mar 02 '18 15:03 rileym94

Have you requested intraday data access from Fitbit?

Although if you're only using your own personal account that may not matter.

simonbromberg avatar Mar 12 '18 01:03 simonbromberg

According to fitbit, as a personal app, we don't need to. https://community.fitbit.com/t5/Web-API-Development/Intraday-data-now-immediately-available-to-personal-apps/td-p/1014524

rileym94 avatar Mar 12 '18 13:03 rileym94

Have you tried the other intraday script?

simonbromberg avatar Mar 12 '18 18:03 simonbromberg

I believe I tried them both, I will retry both of them now just to make sure.

rileym94 avatar Mar 13 '18 14:03 rileym94

Tried again quickly at work, screwed something up where I got 'OAuth2 is not defined'

I'll try again later this afternoon. Gotta prep for a meeting...

rileym94 avatar Mar 13 '18 14:03 rileym94

Also, are you sure there's data during the time period you're testing?

simonbromberg avatar Mar 13 '18 18:03 simonbromberg

Yes. I've pulled data with another app.

rileym94 avatar Mar 13 '18 18:03 rileym94

I'm running into just the same problem! I'll break down some of the troubleshooting I've done so far on intraday_all.gs:

  1. Line 294: var row = o[intradaysfield]["dataset"]; The variable o refers to a .json dictionary which is derived from the result of the fetch on line 280, and the key intradaysfield is set up as the string "activities-heart-intraday".

  2. The fetch on line 280 is returning a result with only one top-level key, "activities-heart". That looks like the reason for that undefined error; there's no "activities-heart-intraday" key to access.

I'm guessing that this means the account is not delivering intraday data for some reason. It's a bit puzzling, since I'm set up as a personal app and it's supposed to grant access to intraday data immediately. I'm going to ask FitBit support about this, but do you all have any thoughts on this?

gravinamike avatar Mar 15 '18 17:03 gravinamike

Have you tried intraday or just intraday_all?

simonbromberg avatar Mar 15 '18 19:03 simonbromberg

I've tried both, and now that I think on it again, intraday has both "activities-heart" and "activities-heart-intraday" keys in its fetch, and works fine on the same account, so it must not be the permissions.

The fetch commands that retrieve these different results differ only in their URL strings:

"https://api.fitbit.com/1/user/-/activities/heart/date/" + dateString + "/1d/1min.json" in intraday_all, which fails

versus

"https://api.fitbit.com/1/user/-/" + currentActivity + "/date/" + dateString+ "/" + dateString + ".json" in intraday, which succeeds.

I tried simply switching out the string from intraday for the one in intraday_all - wish it were that simple, but the error persists!

gravinamike avatar Mar 16 '18 20:03 gravinamike

I'll be glad to test anything, just let me know what I can do to help. I work in IT so I have access to a code editor all day long at work. 👍

rileym94 avatar Mar 23 '18 13:03 rileym94