Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.addtobigquery = functions.database.ref('/logs/$logid').onWrite(event => {
// TODO: Make sure you set the `bigquery.datasetName` Google Cloud environment variable.
const dataset = bigquery.dataset(functions.config().bigquery.datasetname);
// TODO: Make sure you set the `bigquery.tableName` Google Cloud environment variable.
const table = dataset.table(functions.config().bigquery.tablename);
return table.insert({
ID: event.data.key,
MESSAGE: event.data.val().message,
NUMBER: event.data.val().number
});
});