-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.
Description
I updated the gloud up to 0.36.0 version (preveous 0.33.0) and currently I cannot save the data to the datastore using by gcloud.datastore.save(entities, callback). When I tried to save the entities
[
{
"key": {
"name": "120",
"kind": "CD_Campaign",
"path": [
"CD_Campaign",
"120"
]
},
"data": {
"persons": 20,
"attempted": 0,
"contacted": 0,
"bounds": {
"min": {
"lng": -122.50355,
"lat": 37.70851
},
"max": {
"lng": -122.43805,
"lat": 37.7907
}
},
"disp": {
"NH": 0,
"LD": 0,
"VC": 0,
"LB": 0,
"D": 0,
"NC": 0,
"IN": 0,
"DC": 0,
"RF": 0,
"MV": 0,
"WN": 0,
"AV": 0,
"V": 0,
"B": 0,
"LM": 0,
"CB": 0
},
"areaIds": [
"0500000US06075"
]
}
}
]I got the error:
> Error: Illegal value for [object Object] of type double: string (not a number)
> at Error (native)
> at null.<anonymous> (C:\Data\Projects\dashboard\node_modules\protobufjs\dist\ProtoBuf.js:1769:23)
> at ProtoBuf.Reflect.ElementPrototype.verifyValue (C:\Data\Projects\dashboard\node_modules\protobufjs\dist\ProtoBuf.js:1825:25)
> at ProtoBuf.Reflect.FieldPrototype.verifyValue (C:\Data\Projects\dashboard\node_modules\protobufjs\dist\ProtoBuf.js:3436:33)
> at MessagePrototype.set (C:\Data\Projects\dashboard\node_modules\protobufjs\dist\ProtoBuf.js:2443:59)
> at MessagePrototype.set (C:\Data\Projects\dashboard\node_modules\protobufjs\dist\ProtoBuf.js:2434:38)
> at Message (C:\Data\Projects\dashboard\node_modules\protobufjs\dist\ProtoBuf.js:2363:34)
> at ProtoBuf.Reflect.ElementPrototype.verifyValue (C:\Data\Projects\dashboard\node_modules\protobufjs\dist\ProtoBuf.js:1877:28)
> at new ProtoBuf.Map.Map (C:\Data\Projects\dashboard\node_modules\protobufjs\dist\ProtoBuf.js:4894:46)
> at ProtoBuf.Reflect.FieldPrototype.verifyValue (C:\Data\Projects\dashboard\node_modules\protobufjs\dist\ProtoBuf.js:3427:28)
Maybe problem in ProtoBuf.js or in another methods which are sending float value as string into ProtoBuf.js. As a hot fix I changed the code in ProtoBuf.js (line 1825):
// Float
case ProtoBuf.TYPES["float"]:
case ProtoBuf.TYPES["double"]:
/* if (typeof value !== 'number')
fail(typeof value, "not a number");
return value;*/
// hot fix
if (typeof value !== 'number') {
if (typeof value === 'string') {
var asFloat=parseFloat(value);
if (isNaN(asFloat)) {
fail(typeof value, "not a number");
} else {
return asFloat;
}
} else {
fail(typeof value, "not a number");
}
}
return value;
Metadata
Metadata
Assignees
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.