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

New V8 runtime Error and Data Download Error with workarounds (from a newb) #39

Open
katmd14 opened this issue Jun 5, 2020 · 10 comments

Comments

@katmd14
Copy link

katmd14 commented Jun 5, 2020

I have very limited coding experience, and recently went to use the original code by @simonbromberg. I ran into 3 issues that were not addressed in the initial setup instructions, last updated in 2018. I thought I would put them here for other newbs who are just trying to get their Fitbit data.

The first issue is that Google's script editor has been switched over to V8 runtime; which seems to have happened around Feb 2020. This meant that I needed to use the latest version (38) of the OAuth2.0 library, not version 19 as was mentioned.

I needed to tweak the First Date in the gs script to get the data. I had to set the 'getFirstDate' function to the day I was pulling info from. It is defaulted to 01/01/2012 and would not save as any other date for me. I just changed the date in the gs code to be the current date and was able to pull this info when I went to Download Data later.

The remaining issues I ran into have already been addressed in @lordneeko's post and @rubenflamshepherd's post.


The second issue was that the UI has been deprecated. This was well addressed by @lordneeko in his PR#37 post. You just use the Setup.html code and save it as Setup in the script editor and then use the respective gs codes he has listed (intraday.gs, heartrate.gs, etc.) as you would have previously. @pjfarr explained how to do this well in his reply on @lordneeko 's post.

The final issue was that the Project Key for the callback URL did not work for me and I instead used the script ID setup discussed in this post by Jozef Jarosciak and by @rubenflamshepherd's post.


I have only used the heartrate.gs file so far, and it worked. Adjusting for these 3 issues and the date seemed to do the trick. Jozef Jarosciak's instructions were very helpful for someone lacking experience.

**I don't know a lot of the jargon, so I apologize if some of my terminology was off.

@katmd14 katmd14 changed the title New V8 runtime Errors and Data Download Errors Workarounds (from a newb) New V8 runtime Error and Data Download Error with workarounds (from a newb) Jun 5, 2020
@rubenflamshepherd
Copy link

Hey @katmd14, just wanted to say that your documentation above is excellent :) Don't sell yourself short!

@Paige-Lavergne
Copy link

Hey all, I've followed PR#37 and I'm getting "TypeError: Cannot read properties of undefined (reading 'getContentText')" when I try to download my data. My authorization has worked but I'm not 100% sure whats going on here

@Paige-Lavergne
Copy link

No clue if anyone monitors this anymore either lol

@pjfarr
Copy link

pjfarr commented Sep 14, 2023

Hey all, I've followed PR#37 and I'm getting "TypeError: Cannot read properties of undefined (reading 'getContentText')" when I try to download my data. My authorization has worked but I'm not 100% sure whats going on here

I get this every now and then and through trial and error found that if the "start date" goes back further than 3 months it will throw this error. Keeping the date range within the last 3 months seems to fix it. Also, changing the date from the Fitbit > Setup menu sometimes doesn't fix the issue and so I have to do it manually in the Extensions > App Script > Project Settings tab.

Hope this helps, it's what works for me (so far) but I know that it might not work for everyone. 🤞

@Paige-Lavergne
Copy link

I tried your fix of changing the date in the setup menu and it didn't seem to work @pjfarr. can you explain what you do in the project setting tab?

@pjfarr
Copy link

pjfarr commented Sep 14, 2023

In the Project Settings tab (1), if you scroll down you'll see a section named Script Properties (2) and, below that, a box for entering the date. Click the "Edit Script Properties" button (3) and then change the date manually (4) (follow the exact date format—for me it's YYYY-MM-DD). Click "Save script properties" (5) afterward. Go back and reload the sheet the script's attached to.

This fixes it for me.

Screenshot Project Settings - Apps Script

@Paige-Lavergne
Copy link

Paige-Lavergne commented Sep 14, 2023 via email

@pjfarr
Copy link

pjfarr commented Sep 14, 2023

Sorry it didn't work for you, I know this stuff is frustrating and I'm by no means an expert.
Was this script working for you before and then suddenly stopped? Or is this the first time you've tried using it?

@Paige-Lavergne
Copy link

Paige-Lavergne commented Sep 14, 2023 via email

@pjfarr
Copy link

pjfarr commented Sep 14, 2023

The "Loggables" parameter sets up the data categories I want to import (Calories in/out, steps, distance, etc.) I don't use heartrate.gs, it's a separate script I believe. Maybe it aggregates info differently, although the error is the same one I was getting. The script I use is intraday.gs.

A few years back Google changed the way they exchange secure data and it broke the script. The folks here adapted it and got it working again. I remember the nightmare it was for me trying to update the script I had due to many customizations I had made to it but eventually got it working. I'm not sure if this affected the heartrate.gs script too (probably), but if you haven't already, try looking over the info in the README.md file on the <>Code page here. It's been a long time since I set all this up so a lot of it is fuzzy now.

Sorry I couldn't be more help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants