Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-21147

[fiware-stackoverflow] Fiware QuantumLeap Error when receiving subscription message "AttributeError: 'int' object has no attribute 'get'"

    Details

      Description

      Created question in FIWARE Q/A platform on 11-04-2023 at 10:04
      Please, ANSWER this question AT https://stackoverflow.com/questions/75984706/fiware-quantumleap-error-when-receiving-subscription-message-attributeerror-i

      Question:
      Fiware QuantumLeap Error when receiving subscription message "AttributeError: 'int' object has no attribute 'get'"

      Description:
      Fiware QuantumLeap throws an Error when receiving a subscription message from Orion-LD:
      time=2023-04-10 09:05:48.876 | level=ERROR | corr=None | from=172.24.0.8 | srv=None | subserv=None | op=log_exception | comp=server.wsgi | msg=Exception on /v2/notify [POST] | payload=[

      {'id': 'urn:ngsi-ld:Wasserstandsensor:001', 'type': 'Wasserstandsensor', 'observation': 494}

      ] | thread=139933603838752 | process=34
      2023-04-10T09:05:48.877623243Z Traceback (most recent call last):
      2023-04-10T09:05:48.877631202Z File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
      2023-04-10T09:05:48.877634240Z response = self.full_dispatch_request()
      2023-04-10T09:05:48.877636776Z File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
      2023-04-10T09:05:48.877639211Z rv = self.handle_user_exception(e)
      2023-04-10T09:05:48.877641530Z File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
      2023-04-10T09:05:48.877643934Z reraise(exc_type, exc_value, tb)
      2023-04-10T09:05:48.877646229Z File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
      2023-04-10T09:05:48.877648604Z raise value
      2023-04-10T09:05:48.877651288Z File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
      2023-04-10T09:05:48.877654042Z rv = self.dispatch_request()
      2023-04-10T09:05:48.877656649Z File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
      2023-04-10T09:05:48.877659054Z return self.view_functions[rule.endpoint](**req.view_args)
      2023-04-10T09:05:48.877670344Z File "/usr/local/lib/python3.8/site-packages/connexion/decorators/decorator.py", line 48, in wrapper
      2023-04-10T09:05:48.877673234Z response = function(request)
      2023-04-10T09:05:48.877675489Z File "/usr/local/lib/python3.8/site-packages/connexion/decorators/uri_parsing.py", line 144, in wrapper
      2023-04-10T09:05:48.877677872Z response = function(request)
      2023-04-10T09:05:48.877680107Z File "/usr/local/lib/python3.8/site-packages/connexion/decorators/validation.py", line 184, in wrapper
      2023-04-10T09:05:48.877682499Z response = function(request)
      2023-04-10T09:05:48.877684732Z File "/usr/local/lib/python3.8/site-packages/connexion/decorators/validation.py", line 384, in wrapper
      2023-04-10T09:05:48.877687106Z return function(request)
      2023-04-10T09:05:48.877689337Z File "/usr/local/lib/python3.8/site-packages/connexion/decorators/parameter.py", line 121, in wrapper
      2023-04-10T09:05:48.877691704Z return function(**kwargs)
      2023-04-10T09:05:48.877693942Z File "/src/ngsi-timeseries-api/src/reporter/reporter.py", line 154, in notify
      2023-04-10T09:05:48.877696385Z error = _validate_payload(entity)
      2023-04-10T09:05:48.877698631Z File "/src/ngsi-timeseries-api/src/reporter/reporter.py", line 103, in _validate_payload
      2023-04-10T09:05:48.877701580Z if not has_value(payload, attr):
      2023-04-10T09:05:48.877703946Z File "/src/ngsi-timeseries-api/src/reporter/reporter.py", line 61, in has_value
      2023-04-10T09:05:48.877706381Z attr_value = attr.get('value', None)
      2023-04-10T09:05:48.877708808Z AttributeError: 'int' object has no attribute 'get'

      Log from Orion-LD:
      TMP@09:05:48 httpRequestSend.cpp[564]: Sending message 6 to HTTP server: sending message of 713 bytes to HTTP server
      2023-04-10T09:05:48.878008552Z INFO@09:05:48 httpRequestSend.cpp[587]: Notification Successfully Sent to http://fiware-quantumleap:8668/v2/notify?subscriptionId=urn:ngsi-ld:Subscription:25b0913a-d77e-11ed-a74b-0242ac180008

      Subscription Message with Status 201:
      curl --location 'http://localhost:1026/ngsi-ld/v1/subscriptions/' \
      --header 'Content-Type: application/ld+json' \
      --header 'fiware-service: waterlevel' \
      --header 'fiware-servicepath: /' \
      --data-raw '{
      "description": "Notify STH-Comet of all Wasserstand changes",
      "type": "Subscription",
      "entities": [

      {"type": "Wasserstandsensor"}

      ],
      "watchedAttributes": ["observation"],
      "notification": {
      "endpoint":

      { "uri": "http://fiware-quantumleap:8668/v2/notify" }

      ,
      "attributes": ["observation"]
      },
      "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
      }'

      docker-compose:
      crate-db:
      image: crate:4.1.4
      hostname: crate-db
      ports:

      • "4200:4200"
      • "4300:4300"
        command:
        crate -Cauth.host_based.enabled=false -Ccluster.name=democluster
        -Chttp.cors.enabled=true -Chttp.cors.allow-origin="*"
        environment:
      • CRATE_HEAP_SIZE=2g

      fiware-quantumleap:
      image: smartsdk/quantumleap
      hostname: fiware-quantumleap
      ports:

      • "8668:8668"
        depends_on:
      • crate-db
        environment:
      • CRATE_HOST=crate-db

      Do you have any ideas how to fix it?
      Thanks!
      I need the @context because the entity names are FQN and they can't be found otherwise.

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2023-04-12 05:32|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2023-04-12 05:32|CREATED monitor | # answers= 0, accepted answer= False

          People

          • Assignee:
            smartsdk_martel MARTEL
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: