question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhelpful `PartialFailureError` when doing a raw insert.

See original GitHub issue

Having trouble doing a “raw” insert, as described in the API docs here: https://googleapis.dev/nodejs/bigquery/latest/Table.html#insert

It fails with PartialFailureError. Digging into the errors array on it, there’s one element: { message: '', reason: 'invalid' }, which doesn’t give me much to go by.

The operation itself is super simple. It’s simply inserting a string into a table with one column (string).

Environment details

  • OS: MacOS
  • Node.js version: 8 (Cloud Functions engine version)
  • npm version: 6.13.6
  • @google-cloud/bigquery version: 4.6.1

Steps to reproduce

Doing a table.insert like so:

const bq = new BigQuery({ location: 'EU' });
const dataset = bq.dataset('firestore_export');
const table = dataset.table('test');

table.insert({
   skipInvalidRows: false,
   ignoreUnkownValues: false,
   rows: [
      {
        insertId: event.eventId, // (comes from the CF trigger's context.eventId)
        json: {
          document_name: 'test',
        }
      }
   ],
}, { raw: true });

My code is based this, which seems to work fine: https://github.com/firebase/extensions/blob/next/firestore-bigquery-export/firestore-bigquery-change-tracker/src/bigquery/index.ts

Anyway, is PartialFailureError not supposed to give a bit more info about what went wrong?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
shollymancommented, Aug 28, 2020

Essentially, this error response is informing you that the the row data you’ve sent is invalid (it doesn’t conform to what the streaming API understands to be the current schema of the table).

You’ve disabled skipInvalidRows, so the system is surfacing this error.

It may be the case that you’re constructing incompatible messages, or it may be a case of a table has recently changed (deleted/recreated, schema change, etc) and the streaming system hasn’t yet picked up the change. More info here: https://cloud.google.com/bigquery/docs/error-messages#streaming

There’s nothing really actionable here beyond that from the library perspective… The API will not provide more expansive responses describing what’s wrong.

Closing this one for now.

2reactions
larssncommented, May 11, 2020

No, I dont use raw inserts as a result

Read more comments on GitHub >

github_iconTop Results From Across the Web

bigQuery: PartialFailureError on table insert - Stack Overflow
According to my test it seems that there are 2 errors here. First is that you have campaign_id in schema while id in...
Read more >
Class PartialFailureError (4.1.0) | Node.js client library
constructor(errors: GoogleInnerError[], rpcError?: ServiceError | null);. Constructs a new instance of the PartialFailureError class.
Read more >
Class Table | Node.js client library | Google Cloud
function insertHandler(err, apiResponse) { if (err) { // An API error or partial failure occurred. if (err.name === 'PartialFailureError') { // Some rows ......
Read more >
googleads - Go Packages
Package googleads is an auto-generated package for the Google Ads API. Manage your Google Ads accounts, campaigns, and reports with this API ...
Read more >
Codes and formats - Ads API - Google Developers
Criterion ID Parent IDs Category 93017 0 /Banking & Finance 92601 93017 /Banking & Finance/Avid Investors 93019 93017 /Banking & Finance/Banks In‑Person
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found