Pokemon-GO-node-api
Pokemon-GO-node-api copied to clipboard
Protobuf Error: Error: Illegal value for [object Object] of type double: string (not a number)
I am getting an error with Protobuf for what I believe is a server response message that includes a float that is enclosed in a string. The value isn't necessarily wrong, but it needs to be parsed. The way I've been able to solve the issue is by changing a few lines in protobufjs\dist\protobuf.js:
Line 1853:
// Float
case ProtoBuf.TYPES["float"]:
case ProtoBuf.TYPES["double"]:
if (typeof value !== 'number')
if(isNaN(value)){
fail(typeof value, "not a number");
} else {
return parseFloat(value);
}
return value;
I've added in the check to see whether or not the value is not a number. If that's the case, by all means, error out. However, if we can parse it, do so and return that value.
If you are using coords type for location, please make sure latitude, longitude and altitude are numbers instead of string. I hit this error as well :)