telefonicaid / perseo-fe

Front End process for the Perseo CEP
GNU Affero General Public License v3.0
15 stars 29 forks source link

empty details logging BadRequest error retrieved from v2.batchUpdate #788

Open AlvaroVega opened 4 months ago

AlvaroVega commented 4 months ago

This is the log obtained:

time=2024-07-01T12:45:19.279Z | lvl=WARN | corr=3ba5652f-b266-40a4-a791-1bdcc79c9b2f; cbnotif=24; node=EIBaCtTr-0; perseocep=32465 | trans=0224e923-6d92-4ebe-aec4-262681dac9dc | op=/actions/do | path=/actions/do | comp=perseo-fe | srv=AAAAA | subsrv=/BBBB | msg=error v2.batchUpdate: {"name":"BadRequest","details":"","correlator":"3ba5652f-b266-40a4-a791-1bdcc79c9b2f; cbnotif=24; node=EIBaCtTr-0; perseocep=32465"} trying update entity {"actionType":"append","entities":[{"TimeInstant":{"value":"2024-07-01T12:45:19.175Z","type":"DateTime"}}]} after event {"service":"AAAAAAA","ruleName":"myrule","id":"RRRRRR","TimeInstant":"2024-07-01T12:45:19.175Z","subservice":"/BBBBB","fiwarePerseoContext":{"path":"/actions/do","op":"/actions/do","comp":"perseo-fe","trans":"0224e923-6d92-4ebe-aec4-262681dac9dc","corr":"3ba5652f-b266-40a4-a791-1bdcc79c9b2f; cbnotif=24; node=EIBaCtTr-0; perseocep=32465","srv":"AAAAAA","subsrv":"/BBBB"}}

Printed by perseo: https://github.com/telefonicaid/perseo-fe/blob/f118a3b8e5f8c2cf1f03079a1852e9bb7b3b0247/lib/models/updateAction.js#L422

Using ngsijs library: https://github.com/aarranz/ngsijs/blob/0627c2beae11f446774d1ab939a8c47307824159/NGSI.js#L424C58-L424C82

AlvaroVega commented 4 months ago

This could be reproduced with a bad update rule with tries something wrong like:

time=2024-07-16T07:35:58.371Z | lvl=INFO | corr=a4152339-c1e5-425b-a631-90131c8da0c6; cbnotif=1; node=00ykkhrocM1721112953-592-00000000114 | trans=1721112953-592-00000000114 | from=172.17.0.1 | srv=smartcity | subsrv=/ | comp=Orion | op=logTracing.cpp[211]:logInfoRequestWithPayload | msg=Request received: POST /v2/op/update, request payload (120 bytes): {"actionType":"append","entities":[{"abnormal":{"value":7,"type":"DateTime"},"id":"thing:disp1_mirror","type":"Alarm"}]}, response code: 400

IMHO this is similar to issue https://github.com/Ficodes/ngsijs/pull/23 but for BadRequest

@fgalan @aarranz Should we open a similar issue to https://github.com/Ficodes/ngsijs/pull/23 for BadRequest details?

fgalan commented 4 months ago

@fgalan @aarranz Should we open a similar issue to Ficodes/ngsijs#23 for BadRequest details?

I think it's make sense

AlvaroVega commented 2 months ago

The same problem for others error, for example when bachUpdate has received an "InvalidResponse", there is not defails about it:

time=2024-09-18T03:00:00.356Z | lvl=WARN | corr=e937a4f9-4391-4903-946d-43f826293cfc; node=2r6bIQXXEW; perseocep=11893 | trans=1275b7d5-8ae9-4878-8c8a-a3d9b1c9ec39 | op=/actions/do | path=/actions/do | comp=perseo-fe | srv=SSSSSSS | subsrv=/ssssssss | msg=error v2.batchUpdate: {"name":"InvalidResponse","correlator":"CORR; perseocep=11893"} trying update entity

When CB response is 422

time=2024-09-18T03:00:00.355Z | lvl=INFO | corr=CORR perseocep1726583764-195-00000041288 | trans=1726583764-195-00000041288 | from=172.17.0.1 | srv=SSSSSSSSS | subsrv=/sssssss | comp=Orion | op=logTracing.cpp[211]:logInfoRequestWithPayload | msg=Request received: POST /v2/op/update, request payload (816 bytes): {"actionType":"UPDATE","entities":[...........}, response code: 422

related issue: https://github.com/Ficodes/ngsijs/issues/31