In trying to track down why data was not appearing in Bigquery even though the import completed "successfully", I noted that the err argument was not populated even though an error had occurred.
code:
table.import(gcsFile, function(err, job, apiResponse) {
if(err) {
callback(err);
return;
}
console.log('Data import job created');
console.log(apiResponse);
}
The err argument is undefined (or perhaps null), however the apiResponse reports (verbatim from logs):
{ kind: 'bigquery#job',
etag: '"oGMCLvGjZO7RB3oFjn17umMEDU4/v1SSKa6IBg_jGNKysjFGzeC_xYA"',
id: 'gcf-tests:job_19Q8iGmmqYjyV0V7rj5fiSwiQFw',
selfLink: 'https://www.googleapis.com/bigquery/v2/projects/gcf-tests/jobs/job_19Q8iGmmqYjyV0V7rj5fiSwiQFw',
jobReference:
{ projectId: 'gcf-tests',
jobId: 'job_19Q8iGmmqYjyV0V7rj5fiSwiQFw' },
configuration:
{ load:
{ sourceUris: [Object],
destinationTable: [Object],
sourceFormat: 'CSV' } },
status:
{ state: 'DONE',
errorResult:
{ reason: 'invalid',
message: 'No schema specified on job or table.' },
errors: [ [Object] ] },
statistics:
{ creationTime: '1462423012789',
startTime: '1462423012849',
endTime: '1462423012849' },
user_email: '[email protected]' }
It might be reasonable to have developers inspect the status/errorResult property of the apiResponse, but it seems like it would make more sense to report this as an error
In trying to track down why data was not appearing in Bigquery even though the import completed "successfully", I noted that the
errargument was not populated even though an error had occurred.code:
The
errargument isundefined(or perhapsnull), however the apiResponse reports (verbatim from logs):It might be reasonable to have developers inspect the status/errorResult property of the apiResponse, but it seems like it would make more sense to report this as an error