When calling MessageObject.toJSON(), I get the following error:
Cannot read property 'prototype' of null at Function.toObject
Which occurs in this function:
TimeSeriesQueryRequest.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.queries = [];
if (options.defaults) {
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.start_nanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.start_nanos = options.longs === String ? "0" : 0;
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.end_nanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.end_nanos = options.longs === String ? "0" : 0;
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.sample_nanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.sample_nanos = options.longs === String ? "0" : 0;
}
if (message.start_nanos != null && message.hasOwnProperty("start_nanos"))
if (typeof message.start_nanos === "number")
object.start_nanos = options.longs === String ? String(message.start_nanos) : message.start_nanos;
else
object.start_nanos = options.longs === String ? $util.Long.prototype.toString.call(message.start_nanos) : options.longs === Number ? new $util.LongBits(message.start_nanos.low >>> 0, message.start_nanos.high >>> 0).toNumber() : message.start_nanos; // <-- unguarded access to `$util.Long`!!
if (message.end_nanos != null && message.hasOwnProperty("end_nanos"))
if (typeof message.end_nanos === "number")
object.end_nanos = options.longs === String ? String(message.end_nanos) : message.end_nanos;
else
object.end_nanos = options.longs === String ? $util.Long.prototype.toString.call(message.end_nanos) : options.longs === Number ? new $util.LongBits(message.end_nanos.low >>> 0, message.end_nanos.high >>> 0).toNumber() : message.end_nanos;
if (message.queries && message.queries.length) {
object.queries = [];
for (var j = 0; j < message.queries.length; ++j)
object.queries[j] = $root.cockroach.ts.tspb.Query.toObject(message.queries[j], options);
}
if (message.sample_nanos != null && message.hasOwnProperty("sample_nanos"))
if (typeof message.sample_nanos === "number")
object.sample_nanos = options.longs === String ? String(message.sample_nanos) : message.sample_nanos;
else
object.sample_nanos = options.longs === String ? $util.Long.prototype.toString.call(message.sample_nanos) : options.longs === Number ? new $util.LongBits(message.sample_nanos.low >>> 0, message.sample_nanos.high >>> 0).toNumber() : message.sample_nanos;
return object;
};
This code was generated with --strict-long, so I'm not really sure why util.Long is undefined, or why any of the code paths above need to be guarded with if ($util.Long) {.
When calling MessageObject.toJSON(), I get the following error:
Which occurs in this function:
This code was generated with
--strict-long, so I'm not really sure whyutil.Longis undefined, or why any of the code paths above need to be guarded withif ($util.Long) {.