Skip to content

insertRowsAsStream not showing full error log #399

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

Activity

  1. yrjsg commented on Jun 6, 2017

    @yrjsg

    I've the same issue when run this code in Cloud Function. No errors are returned but no rows are in Bigquery

  2. ace-n commented on Jul 11, 2017

    @ace-n
    Contributor

    @digithunz @frankyaorenjie thanks for reporting this! As of #421, this has been fixed.

  3. added a commit that references this issue on Nov 16, 2022
  4. added a commit that references this issue on Nov 17, 2022
  5. added a commit that references this issue on Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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