uncaughtException undefined is not a function

        var cluster = new couchbase.Cluster('couchbase://localhost');
		var bucket = cluster.openBucket('default');
		bucket.upsert('testdoc', {name:'Frank'}, function(err, result) {
		  if (err) console.log( err);
		  bucket.get('testdoc', function(err, result) {
		    if (err) throw err;
		    console.log(result.value);
		    // {name: Frank}
		  });
		});

I get below error with above snippet. I tried different version(2.0.0, 2.0.4) but my app wont connect to couchbase server.
The error is thrown after i call 'bucket.upsert'.

Fri, 23 Jan 2015 14:18:19 GMT uncaughtException undefined is not a function
TypeError: undefined is not a function

I am developing application on mac OSX. I am not sure what am i doing wrong because the snippet seems to be very simple.