简体   繁体   中英

Error when launching dataflow pipeline from cloud function

I'm trying to run a pipeline from a google cloud function. Unfortunately, I cannot get passed the first lines of all the examples I found.

I installed the google apis:

npm install googleapis --save

This is the code I'm trying to run for now:

const google = require('googleapis');
const dataflow = google.dataflow('v1b3');

However I get the following error:

const dataflow = google.dataflow('v1b3');
                        ^

TypeError: google.dataflow is not a function

From all the examples I've seen, this should be enough to give a dataflow client.

I finally made this work by changing the code to:

var {google} = require('googleapis');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM