Skip to content

insertRowsAsStream not showing full error log #399

@luna-ci

Description

@luna-ci

I have tried created a table using the api successfully with 2 fields as nullable.
However I was unable to insertRowsAsStream as using code below

const params = {
        datasetId: "Event",
        tableId: "navigation9",
        projectId: "xxxx-9a8cd",
        rows: [
          { Name: "test0", Age: 0 },
          { Name: "test2", Age: 1 },
          { Name: "test3", Age: 2 },
          { Name: "test4", Age: 3 },
          { Name: "test5", Age: 0 }
        ]
      }

insertRowsAsStream(params)

const insertRowsAsStream = ({ datasetId, tableId, rows, projectId }) => new Promise((resolve, reject) => {
  const BigQuery = require('@google-cloud/bigquery');

  // Instantiates a client
  const bigquery = BigQuery({
    projectId: projectId
  });

  console.log('insertRowAsStream rows = ', JSON.stringify(rows, null, 2))

  // Inserts data into a table
  bigquery
    .dataset(datasetId)
    .table(tableId)
    .insert(rows)
    .then((insertErrors) => {
      console.log('Inserted:');
      rows.forEach((row) => console.log(row));

      if (insertErrors && insertErrors.length > 0) {
        console.log('Insert errors:');

        insertErrors.forEach((err) => console.error(err));
        reject('ERROR: ' + JSON.stringify(insertErrors, null, 2));
      } else {
        resolve('Sucessfully Inserted')
      }
    })
    .catch((err) => {

      console.error('ERROR:', err);
      reject('ERROR:' + err);

    });
  // [END bigquery_insert_stream]
});

The log result i got is not very helpful


Inserted: 
{ Name: 'test0', Age: 0 }
{ Name: 'test2', Age: 1 }
{ Name: 'test3', Age: 2 }
{ Name: 'test4', Age: 3 }
{ Name: 'test5', Age: 0 }
Insert errors:
{ kind: 'bigquery#tableDataInsertAllResponse' }

Here is do not know what causing the error

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.triage meI really want to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions