Node BigQuery package -- ENOENT error on Ubuntu

Saturday, May 3, 2014

I am trying to use the BigQuery package found here: http://ift.tt/1fGRwZQ


Setup: Ubuntu 14, latest Node, nginx, plus that bigquery package and its dependencies.


I believe I've set it up correctly, including the PEM files, but I am getting an error from gauth when I try to load the key files:



[2014-05-04 02:14:57.008] [ERROR] gauth - { [Error: ENOENT, open './key.mydomain.com.p12.pem']
errno: 34,
code: 'ENOENT',
path: './key.mydomain.com.p12.pem' }
Error: ENOENT, open './key.mydomain.com.p12.pem'


I am running just a simple test script that looks like so (I've Xxxx'd out my project ID):



var http = require('http')
, bq = require('bigquery')
, fs = require('fs')
, prjId = 'xxxxxxxxxx'; //you need to modify this

bq.init({
scope: 'http://ift.tt/UJiXBu',
client_secret: './client_secrets.json',
privatekey_pem: './private.mydomain.com.p12.pem',
key_pem: './key.mydomain.com.p12.pem'
});


http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Testing BigQuery... \n');

bq.job.query(prjId, 'select count(*) from publicdata:samples.wikipedia', function(e,r,d){
if(e) console.log(e);
console.log( JSON.stringify(d) );
});

res.end('Done. \n');
}).listen(3000, "127.0.0.1");
console.log('Server running at http://127.0.0.1:3000/');


I've tried referencing the file different, using __dirname and also no slashes.


Any thoughts? I'm looking at the Google code in the dependencies, too, but just not figuring this one out.







http://ift.tt/1fGRyRo