diff --git a/lib/services/ngsi/entities-NGSI-v2.js b/lib/services/ngsi/entities-NGSI-v2.js index d593b50a6..38fa0c36f 100644 --- a/lib/services/ngsi/entities-NGSI-v2.js +++ b/lib/services/ngsi/entities-NGSI-v2.js @@ -352,7 +352,8 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca let url = '/v2/op/update'; if (typeInformation && typeInformation.type) { - payload.entities[0].type = typeInformation.type; + // CB entity type should be always a String + payload.entities[0].type = String(typeInformation.type); } payload.actionType = 'append'; @@ -833,10 +834,10 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca payload ); } - + // CB entity id and type should be always a String let newEntity = { - id: newEntityName ? newEntityName : payload.entities[0].id, - type: attr.entity_type ? attr.entity_type : payload.entities[0].type + id: newEntityName ? String(newEntityName) : String(payload.entities[0].id), + type: attr.entity_type ? String(attr.entity_type) : String(payload.entities[0].type) }; // Check if there is already a newEntity created const alreadyEntity = payload.entities.find((entity) => { diff --git a/package.json b/package.json index 821ede4b0..6ebd2463d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "iotagent-node-lib", "license": "AGPL-3.0-only", "description": "IoT Agent library to interface with NGSI Context Broker", - "version": "3.4.2", + "version": "3.4.3", "homepage": "https://github.com/telefonicaid/iotagent-node-lib", "keywords": [ "fiware",