googledatastudio / community-connectors

This repository contains open source content for Google Data Studio.
https://datastudio.google.com/
Apache License 2.0
557 stars 265 forks source link

Google-Fit connector object not defined #289

Open thompsonson opened 4 years ago

thompsonson commented 4 years ago

I have followed the instruction here: https://github.com/googledatastudio/community-connectors/blob/master/deploy.md

When I connect\run the App Script I get an error. This is what the StackDriver logs are saying.

Jan 18, 2020, 10:40:22 AM Error ReferenceError: "connector" is not defined. at getAuthType(main.js:27)

I'm OKish with JavaScript and it looks like the connector object is not defined..... :-p

Running through the code here https://github.com/googledatastudio/community-connectors/tree/master/google-fit/src I don't actually see it being declared anywhere. Should be be creating the object from the name of the file or something else occurring?

Thanks in advance, Matt

skimdankish commented 4 years ago

I actually had to roll it back to the previous commit: https://github.com/googledatastudio/community-connectors/tree/c33387edd5e1ce262bfdef413ab2c5ec5646b1af/google-fit/src

I used these files and worked like a charm, I was even able to add others such as calories, heart & active minutes to my script.

It looks like the most recent commit either broke it, or requires more finesse that provided in the README.

falcaopetri commented 4 years ago

I got the same error, but looking through the diffs I realized that the connector's functions have been factored out to the global scope. This means that we do not need main.js' functions anymore.

For example, check out the getSchema definition here: https://github.com/googledatastudio/community-connectors/commit/460965a73bed59518da078a917892516affa40d5#diff-c78a44a34e314eeb97ef993b080f3935L379.

Actually, it seems we do not need main.js anymore.

Nonetheless, after succesfully connecting, I got stuck on issue #266 .