FIWARE / helm-charts

:globe_with_meridians: Kubernetes HELM Charts for FIWARE Generic Enablers for provisioning scalable, production-ready powered-by-FIWARE installations based around NGSI Context Brokers and other components
MIT License
24 stars 31 forks source link

[iotagent-ul] How to enable NGSIv2 in iotagent-ul helmchart? #131

Closed sfl0r3nz05 closed 2 years ago

sfl0r3nz05 commented 2 years ago

Hi, I received {"name":"BAD_REQUEST","message":"Request error connecting to the Context Broker: 501"} error when when I send a POST to iotagent-ul deployed via iotagent-ul helm chart.

I get the following log via kubectl logs pod/iotagent-ul-xxxxxx:

time=2022-10-08T09:03:18.182Z | lvl=DEBUG | corr=d7ed414d-a132-45ea-b4a3-38ee14a828dc | trans=d7ed414d-a132-45ea-b4a3-38ee14a828dc | op=IoTAgentNGSI.Request | from=n/a | srv=openiot | subsrv=/ | msg=Response {
    "error": "NotImplemented",
    "description": "Only NGSIv1-based forwarding supported at the present moment. Set explictely legacyForwarding to true"
}

Following the iotagent-ul documentation to enable NGSIv2 it must be set ngsiVersion in contextBroker:

{
    host: '192.168.56.101',
    port: '1026',
    ngsiVersion: 'v2'
}

So, I have modified:

{
  contextBroker:
    # -- host of the broker
    host: 192.168.49.2
    # -- port of the broker
    port: 30005
    # to use NGSI v2
    ngsiVersion: v2
}
contextBroker: {
            /**
             * Host where the Context Broker is located.
             */
            host: '{{ .Values.iota.contextBroker.host }}',

            /**
             * Port where the Context Broker is listening.
             */
            port: '{{ .Values.iota.contextBroker.port }}'

            /**
             * If you want to use NGSI v2.
             */
            ngsiVersion: '{{ .Values.iota.contextBroker.ngsiVersion }}'
        }

However, the new pod status is CrashLoopBackOff and the log received via kubectl logs pod/iotagent-ul-xxxx is:

{"op":"IoTAgentNGSI.DomainControl","time":"2022-10-08T09:15:31.479Z","lvl":"ERROR","msg":"/opt/iotaul/config.js:55\n        ngsiVersion: 'v2'\n        ^^^^^^^^^^^\n\nSyntaxError: Unexpected identifier\n    at Object.compileFunction (node:vm:360:18)\n    at wrapSafe (node:internal/modules/cjs/loader:1055:15)\n    at Module._compile (node:internal/modules/cjs/loader:1090:27)\n    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)\n    at Module.load (node:internal/modules/cjs/loader:1004:32)\n    at Function.Module._load (node:internal/modules/cjs/loader:839:12)\n    at Module.require (node:internal/modules/cjs/loader:1028:19)\n    at require (node:internal/modules/cjs/helpers:102:18)\n    at start (/opt/iotaul/bin/iotagent-ul:41:18)\n    at Object.<anonymous> (/opt/iotaul/bin/iotagent-ul:56:1)\n    at Module._compile (node:internal/modules/cjs/loader:1126:14)\n    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)\n    at Module.load (node:internal/modules/cjs/loader:1004:32)\n    at Function.Module._load (node:internal/modules/cjs/loader:839:12)\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n    at node:internal/main/run_main_module:17:47 {\n  domainThrown: true\n}"}

Any suggestions on how to properly configure NGSIv2?

sfl0r3nz05 commented 2 years ago

[update]

I fixed this error:

{"op":"IoTAgentNGSI.DomainControl","time":"2022-10-08T09:15:31.479Z","lvl":"ERROR","msg":"/opt/iotaul/config.js:55\n        ngsiVersion: 'v2'\n        ^^^^^^^^^^^\n\nSyntaxError: Unexpected identifier\n    at Object.compileFunction (node:vm:360:18)\n    at wrapSafe (node:internal/modules/cjs/loader:1055:15)\n    at Module._compile (node:internal/modules/cjs/loader:1090:27)\n    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)\n    at Module.load (node:internal/modules/cjs/loader:1004:32)\n    at Function.Module._load (node:internal/modules/cjs/loader:839:12)\n    at Module.require (node:internal/modules/cjs/loader:1028:19)\n    at require (node:internal/modules/cjs/helpers:102:18)\n    at start (/opt/iotaul/bin/iotagent-ul:41:18)\n    at Object.<anonymous> (/opt/iotaul/bin/iotagent-ul:56:1)\n    at Module._compile (node:internal/modules/cjs/loader:1126:14)\n    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)\n    at Module.load (node:internal/modules/cjs/loader:1004:32)\n    at Function.Module._load (node:internal/modules/cjs/loader:839:12)\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n    at node:internal/main/run_main_module:17:47 {\n  domainThrown: true\n}"}

I missed a , in configmap.yaml

contextBroker: {
            /**
             * Host where the Context Broker is located.
             */
            host: '{{ .Values.iota.contextBroker.host }}',

            /**
             * Port where the Context Broker is listening.
             */
            port: '{{ .Values.iota.contextBroker.port }}',

            /**
             * If you want to use NGSI v2.
             */
            ngsiVersion: '{{ .Values.iota.contextBroker.ngsiVersion }}'
        }

However, the error {"name":"BAD_REQUEST","message":"Request error connecting to the Context Broker: 501"} persists, with the same log:

time=2022-10-08T09:48:21.184Z | lvl=DEBUG | corr=d11a8a9a-ff9a-4748-9f47-4fce66054360 | trans=d11a8a9a-ff9a-4748-9f47-4fce66054360 | op=IoTAgentNGSI.Request | from=n/a | srv=openiot | subsrv=/ | msg=Response {
    "error": "NotImplemented",
    "description": "Only NGSIv1-based forwarding supported at the present moment. Set explictely legacyForwarding to true"
}
sfl0r3nz05 commented 2 years ago

[Update]

I have updated orion version to 3.7.0 from fiware/orion repository, previously I was using quay.io/fiware/orion-ld repository. The logging error is:

time=2022-10-08T18:17:24.614Z | lvl=ERROR | corr=841d2b61-463e-42ff-acd7-d0f4b867b7b3 | trans=841d2b61-463e-42ff-acd7-d0f4b867b7b3 | op=IoTAgentNGSI.DeviceService | srv=openiot | subsrv=/ | msg=Registration error connecting to the Context Broker: {"code":"400","reasonPhrase":"Bad Request","details":"missing isDomain value for registration attribute"} | comp=IoTAgent
sfl0r3nz05 commented 2 years ago

I am trying to solve the issue on SOF (https://stackoverflow.com/questions/74003335/how-to-enable-ngsiv2-in-iotagent-ul-helmchart), so I will close the issue.