-
Notifications
You must be signed in to change notification settings - Fork 641
Closed
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Hi,
I am trying to switch to the new method of requiring only the modules that I need instead of the entire google-cloud module. I'm running into a problem importing files from cloud storage into bigquery. This was working until I switched to requiring separate modules.
const bigQuery = require('@google-cloud/bigquery')({
projectId: [projectId],
client_email: [email],
private_key: [key string]
});
const gcs = require('@google-cloud/storage')({
projectId: [projectId],
client_email: [email],
private_key: [key string]
});
var file = gcs.bucket([bucket name]).file('afile.csv');
// This debug output prints "true"
console.log(file instanceof require("@google-cloud/storage").File);
bigQuery
.dataset([dataset ID])
.table([table ID])
.import([file], next);The import call fails with:
Error: Source must be a File object.
at /[project dir]/node_modules/@google-cloud/bigquery/src/table.js:809:15
Adding a debug prop to require('@google-cloud/storage'), it looks like my app and the bigquery modules have two different instances of the storage module, causing instanceof to report the files passed as being the wrong type.
Environment details
- OS: OSX 10.11.6
- Node.js version: v4.4.4
- npm version: 2.15.1
- gcloud-node version: v0.1.1 for both /bigquery and /storage
This seems like a bug, but I could be missing something. Any help would be appreciated, thanks!
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.