telefonicaid / iotagent-node-lib

Module to enable IoT Agent developers to build custom agents for their devices that can easily connect to NGSI Context Brokers
https://iotagent-node-lib.rtfd.io/
GNU Affero General Public License v3.0
60 stars 85 forks source link

ensure service and subservice in context of error handlers using req headers #1486

Closed AlvaroVega closed 10 months ago

AlvaroVega commented 10 months ago
AlvaroVega commented 10 months ago

Executing a case with results in a GENERIC_ENTITY_ERROR:

curl -i -X POST 'http://localhost:7897/iot/json?i=disp1&k=idmaootoin375kl9iifz7472z' -d '{"m": 3, "id": "mierda", "type":"otro"}' -H 'content-type: application/json' HTTP/1.1 400 Bad Request X-Powered-By: Express Content-Type: application/json; charset=utf-8 Content-Length: 103 ETag: W/"67-0km8hkq4ITwy5yfPMIVUrGE/xUA" Date: Tue, 03 Oct 2023 08:24:36 GMT Connection: keep-alive Keep-Alive: timeout=5

{"name":"ENTITY_GENERIC_ERROR","message":"Error accesing entity data for device: disp1 of type: thing"}

and iotagent logs:

time=2023-10-03T08:24:36.591Z | lvl=DEBUG | corr=a70a8da0-b553-4279-ba95-5a34c22bda16 | trans=a70a8da0-b553-4279-ba95-5a34c22bda16 | op=IoTAgentNGSI.Request | from=n/a | srv=smartcity | subsrv=/ | msg=Response { "error": "BadRequest", "description": "Invalid JSON type for entity type" } | comp=IoTAgent time=2023-10-03T08:24:36.592Z | lvl=DEBUG | corr=a70a8da0-b553-4279-ba95-5a34c22bda16 | trans=a70a8da0-b553-4279-ba95-5a34c22bda16 | op=IoTAgentNGSI.Entities-v2 | from=n/a | srv=smartcity | subsrv=/ | msg=Unknown error executing update operation | comp=IoTAgent time=2023-10-03T08:24:36.592Z | lvl=DEBUG | corr=a70a8da0-b553-4279-ba95-5a34c22bda16 | trans=a70a8da0-b553-4279-ba95-5a34c22bda16 | op=IOTAJSON.HTTP.Binding | from=n/a | srv=smartcity | subsrv=/ | msg=Error [ENTITY_GENERIC_ERROR] handling request: Error accesing entity data for device: disp1 of type: thing | comp=IoTAgent time=2023-10-03T08:24:36.592Z | lvl=ERROR | corr=a70a8da0-b553-4279-ba95-5a34c22bda16 | trans=a70a8da0-b553-4279-ba95-5a34c22bda16 | op=IOTAJSON.HTTP.Binding | from=n/a | srv=smartcity | subsrv=/ | msg=MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: {"name":"ENTITY_GENERIC_ERROR","message":"Error accesing entity data for device: disp1 of type: thing","details":{"error":"BadRequest","description":"Invalid JSON type for entity type"},"code":400} | comp=IoTAgent