Connecting to a locally running bigtable emulator from node.js, I need to be able to determine if a particular row exists. While this works as expected for rows that do exist, if seems that row.exits() hangs indefinitely for keys not contained in the table.
Here's a minimal sample:
const { Bigtable } = require('@google-cloud/bigtable');
const btInstance = Bigtable().instance('test');
const table = btInstance.table('testTable');
const [tableExists] = await table.exists();
if (!exists) {
await table.create();
await table.createFamily('testFamily');
}
const row = await table.row('testkey');
console.log('Table existence ensured. Checking if row exists...');
// fine till here...
const [rowExists] = await row.exists();
// may never get here, if connected to the emulator and row *doesn't* exist
if (!rowExists) {
console.log('Row doesn\'t exist!');
} else {
console.log('Row already exists.');
}
When connecting to a live Google Cloud instance of Bigtable, the code runs fine: a nonexistent row is reported. When connecting to the emulator, however, if a row doesn't exist the code never goes past the row.exists() call; no error is thrown either.
Is there anything wrong with what I'm trying to do, or is some workaround possible (perhaps a different way to check if a row exists for a given key)?
gcloud --versionshowsGoogle Cloud SDK 252.0.0; beta 2019.05.17- eotnhaioe