Skip to content

TypeError: gcs is not a function error occurs when trying to use Google Cloud Storage as a datastore #199

Description

@myoshibe

Hi, I encountered an error which indicates that gcs is no longer a function when trying to leverage with Google Cloud Storage (gcs).

⚠️ : TypeError: gcs is not a function

From my quick investigation, you can fix it replacing the codes like below for the time being:

https://github.com/looker/lookerbot/blob/master/src/stores/google_cloud_store.ts

in line 5

// const gcs = require("@google-cloud/storage")
const {Storage} = require("@google-cloud/storage")

in line 19

    // const storage = gcs({
    // credentials: process.env.GOOGLE_CLOUD_CREDENTIALS_JSON ? JSON.pa
rse(process.env.GOOGLE_CLOUD_CREDENTIALS_JSON) : undefined,
    // projectId: process.env.GOOGLE_CLOUD_PROJECT,
    // })
    const storage = new Storage({
      credentials: process.env.GOOGLE_CLOUD_CREDENTIALS_JSON ? JSON.par
se(process.env.GOOGLE_CLOUD_CREDENTIALS_JSON) : undefined,
      projectId: process.env.GOOGLE_CLOUD_PROJECT,
    })

Since I'm not sure this could be a permanent measure, just allow me to leave an issue instead of PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions