How to correctly use the HTTP NODE API for BigQuery to create a dataset without encountering a GetAddrInfoReqWrap error?

This topic was automatically generated from Slack. You can find the original thread here.

Hello community :slightly_smiling_face:

I’m trying to use the HTTP NODE API for BigQuery (since only insert rows is supported).

In this example, I’m looking to test just creating a dataset.

module.exports = defineComponent({
  props: {
    google_cloud: {
      type: "app",
      app: "google_cloud",
    }
  },
  async run({ steps, $ }) {
    // Required workaround to get the @google-cloud/storage package
    // working correctly on Pipedream
    require("@dylburger/umask")()

    // Imports the Google Cloud client library
    const { BigQuery } = require('@google-cloud/bigquery');

    async function createDataset() {
      // Creates a client
      const bigqueryClient = new BigQuery();

      // Create the dataset
      const [dataset] = await bigqueryClient.createDataset('test_from_pipedream');
      console.log(`Dataset ${dataset.id} created.`);
    }
    createDataset();


  },
})

The result is This step was still trying to run code when the step ended. Make sure you promisify callback functions and await all Promises. (Reason: GetAddrInfoReqWrap, Learn more: https://pipedream.com/docs/code/nodejs/async/)

Any help is appreciated. Thank you so much :slightly_smiling_face:

Hi , maybe you can try await createDataset()

Hi Thank you so much!

Now we’re getting somewhere.

Now I’m getting this:

Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.

The action is the Google Cloud one where I have the service account set up with the JSON key.

you’ll need to pass Google Cloud credentials to your code const bigqueryClient = new BigQuery().

I think the easiest way for you is to request a new component here for your usecae (.i.e Bigquery create dataset), so that Pipedream component dev can build the action for you

Oh okay. As a new requester what should one request in terms of actually getting the component added and in what timeframe?

It’s typically shipped in a week. But it also depends on the dev team workload