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

SECURITY_INFORMATION_MISSING error is missing information #1316

Open rosieks opened 1 year ago

rosieks commented 1 year ago

I try to setup OPC UA agent with OAuth authentication and I get the following error:

2023-03-07 08:51:11 time=2023-03-07T07:51:11.428Z | lvl=ERROR | corr=70688d7e-4ec4-4040-804a-dc0070d1156c | trans=70688d7e-4ec4-4040-804a-dc0070d1156c | op=IoTAgentNGSI.Devices-LD | from=n/a | srv=gtm_jakob | subsrv=/demo | msg=ORION-001: Connection error creating inital entity in the Context Broker: SecurityInformationMissing {
2023-03-07 08:51:11   name: 'SECURITY_INFORMATION_MISSING',
2023-03-07 08:51:11   message: 'Some security information was missing for device type:undefined'
2023-03-07 08:51:11 } | comp=IoTAgent

Unfortunately, this error doesn't provide any helpful information. Could you improve it by logging somehow real error here: https://github.com/telefonicaid/iotagent-node-lib/blob/ed74c96d0a6b8fe485ef4e428a25aa2b60091b94/lib/services/northBound/restUtils.js#L217

rosieks commented 1 year ago

Eventually I found that this problem was caused by using OAuth2 authentication and there was no trust defined for device. I had to analyse code to figure it out so defiantly it would be good to have better description

mapedraza commented 1 year ago

I try to setup OPC UA agent with OAuth authentication and I get the following error:

2023-03-07 08:51:11 time=2023-03-07T07:51:11.428Z | lvl=ERROR | corr=70688d7e-4ec4-4040-804a-dc0070d1156c | trans=70688d7e-4ec4-4040-804a-dc0070d1156c | op=IoTAgentNGSI.Devices-LD | from=n/a | srv=gtm_jakob | subsrv=/demo | msg=ORION-001: Connection error creating inital entity in the Context Broker: SecurityInformationMissing {
2023-03-07 08:51:11   name: 'SECURITY_INFORMATION_MISSING',
2023-03-07 08:51:11   message: 'Some security information was missing for device type:undefined'
2023-03-07 08:51:11 } | comp=IoTAgent

Unfortunately, this error doesn't provide any helpful information. Could you improve it by logging somehow real error here:

https://github.com/telefonicaid/iotagent-node-lib/blob/ed74c96d0a6b8fe485ef4e428a25aa2b60091b94/lib/services/northBound/restUtils.js#L217

Since you identified where the logging needs to improve, are you wiling to contribute by adding the required information to the log message? A PR is welcome.