Google-cloud Typeerror: Gcs.bucket Is Not A Function
I am trying to implement cloud function but getting error if i require it like this var storage =require('@google-cloud/storage')(); like this when deploying var storage = req
Solution 1:
The API changed in version 2.x of the Cloud Storage node SDK. According to the documentation, you import the SDK like this:
// Imports the Google Cloud client libraryconst {Storage} = require('@google-cloud/storage');
Then you can create a new Storage object:
// Creates a clientconst storage = newStorage();
Then you can reach into a bucket:
const bucket = storage.bucket()
Post a Comment for "Google-cloud Typeerror: Gcs.bucket Is Not A Function"