74Labs / node-red-contrib-google

Node-RED node for Google APIs.
MIT License
7 stars 22 forks source link

TypeError: google[api.name] is not a function #17

Open AliPST opened 5 years ago

AliPST commented 5 years ago

Hi,

I get an error ("TypeError: google[api.name] is not a function"), at this statement (exactly at line 123): var api = decodeAPI(node.api); api = google[api.name]({ version: api.version, auth: auth });

It looks like the "google" variable does not get initialized as expected. I am saying that b/c "google.discovery('v1');" works fine (and it populates the api list and operation), but "google[api.name]" does not. I even tried to change the code and statically call the api that I need (e.g. _google.dialogflow), but I got the same error.

Any idea?

Here are the environment settings and conditions:

danleighton commented 5 years ago

Did you work this out in the end?

Not sure what is going on here and getting the same error.

AliPST commented 5 years ago

We finally couldn't fix the problem, and instead we used the following library: https://flows.nodered.org/node/node-red-contrib-dialogflowv2-api

On Mon, Jul 22, 2019 at 8:20 AM Dan Leighton notifications@github.com wrote:

Did you work this out in the end?

Not sure what is going on here and getting the same error.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/74Labs/node-red-contrib-google/issues/17?email_source=notifications&email_token=AGKCHXDEE2C4QIU3BH63DOTQAWQX3A5CNFSM4GNBTA2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2PXUBI#issuecomment-513767941, or mute the thread https://github.com/notifications/unsubscribe-auth/AGKCHXFKQ5HBFX6SXRPQYETQAWQX3ANCNFSM4GNBTA2A .

danleighton commented 5 years ago

Ah, I have used that node for dialogflow. But I need to be able to use a whole heap of APIs. I don't think that one can be used for anything except Dialogflow? Or is it more flexible than that... I don't imagine it is?

AliPST commented 5 years ago

you are right. it is only for the dialogflow. It's been a while since I worked on this issue and honestly, i don't remember the details about it. But I have a vague memory that this library wasn't an independent thing, and it was part of a bigger library, without which it is not fully functional. Take this with a grain of salt...

danleighton commented 5 years ago

That is the Viseo Google Library I think you are thinking of - which is part of a bigger library. It's kind of cool, but uses an old version of NodeRed - so not so good. And a pain to install. Pity.

Thanks for the help. Best wishes.