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

FIWARE.Question.Tech.Unable to create the STH context broker subscription.

    Details

      Description

      Created question in FIWARE Q/A platform on 07-10-2016 at 10:10
      Please, ANSWER this question AT http://stackoverflow.com/questions/39912665/unable-to-create-the-sth-context-broker-subscription

      Question:
      Unable to create the STH context broker subscription

      Description:
      I'm using the master branch of the sth-comet's github repo (currently a prerelease of 2.0.0-next) and I am able to install and execute it. The problem appears when I want to create the subscription on the context broker (v1.4.0). Both services are installed in the same FIWARE Lab machine and I accessing them remotely using a public IP address.

      I've been trying to create the subscription using the template provided in your documentation, but the STH is always complaining about the FIWARE-Service and the FIWARE-ServicePath headers (seems the context broker is not sending them along the notifications). This is the command for creating the subscription:

      curl $(orionserver)/v1/subscribeContext s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -H 'FIWARE-Service: default' -H 'FIWARE-ServicePath: /' -d @ <<EOF
      {
      "entities": [

      { "type": "weather.station", "isPattern": "true", "id": ".*" }

      ],
      "attributes": [
      "temperature",
      "humidity"
      ],
      "reference": "$(sthserver)/notify",
      "duration": "P1M",
      "notifyConditions": [

      { "type": "ONCHANGE", "condValues": [ "temperature", "humidity" ] }

      ],
      "throttling": "PT5S"
      }
      EOF

      This is the reported error:

      time=2016-10-06T15:56:30.124Z | lvl=WARN | corr=7220efae-8bdd-11e6-96a8-fa163ea89c59 | trans=11ef935c-f749-46b7-bcd4-942ffddedd27 | op=OPER_STH_POST | srv=default | subsrv=n/a | msg=POST /notify, event={"request":"1475769390111:robots:23181:ityixskh:10000","timestamp":1475769390123,"tags":["validation","error","headers"],"data":{"data":{"data":null,"isBoom":true,"isServer":false,"output":{"statusCode":400,"payload":

      {"statusCode":400,"error":"Bad Request","message":"child \"fiware-servicepath\" fails because [fiware-servicepath is required]"}

      ,"headers":{}}},"isBoom":true,"isServer":false,"output":{"statusCode":400,"payload":{"statusCode":400,"error":"Bad Request","message":"child \"fiware-servicepath\" fails because [fiware-servicepath is required]","validation":{"source":"headers","keys":[]}},"headers":{}}},"internal":true}

      If I use v2 of the context broker API, I'm able to force it to send the FIWARE-Service and FIWARE-ServicePath headers:

      curl $(orionserver)/v2/subscriptions s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -H 'FIWARE-Service: default' -H 'FIWARE-ServicePath: /' -d @ <<EOF
      {
      "description": "STH subscription",
      "subject": {
      "entities": [

      { "type": "weather.station", "idPattern": ".*" }

      ],
      "condition":

      { "attrs":[ "temperature", "humidity" ] }

      },
      "notification": {
      "attrsFormat": "legacy",
      "httpCustom": {
      "url": "$(sthserver)/notify",
      "headers":

      { "FIWARE-Service": "default", "FIWARE-ServicePath": "/" }

      },
      "attrs": [
      "temperature",
      "humidity"
      ]
      },
      "expires": "2018-04-05T14:00:00.00Z",
      "throttling": 5
      }
      EOF

      This way, the STH server does not compliant about the headers, althouth it raises other errors:

      time=2016-10-06T15:46:57.564Z | lvl=ERROR | corr=19e59f02-8bdc-11e6-8534-fa163ea89c59 | trans=1b7fc29a-7f5c-449d-9238-d2e644154b05 | op=OPER_STH_POST | srv=default | subsrv=/ | msg=POST /notify, event=

      {"request":"1475768812582:robots:8985:itycaq0o:10003","timestamp":1475768817564,"tags":["request","closed","error"],"internal":true}

      time=2016-10-06T15:47:02.592Z | lvl=ERROR | corr=19e59f02-8bdc-11e6-8534-fa163ea89c59 | trans=7e5bf417-0b1d-4b53-b47b-838cead91b94 | op=OPER_STH_POST | srv=default | subsrv=/ | msg=POST /notify, event=

      {"request":"1475768817606:robots:8985:itycaq0o:10004","timestamp":1475768822592,"tags":["request","closed","error"],"internal":true}

      I've also tested without using "attrsFormat": "legacy" when creating the subscription (without success).

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2016-10-07 12:05|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2016-10-07 12:05|CREATED monitor | # answers= 0, accepted answer= False
        Hide
        backlogmanager Backlog Manager added a comment -

        2016-10-07 15:05|UPDATED status: transition Answer| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2016-10-07 15:05|UPDATED status: transition Answer| # answers= 1, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2016-10-07 18:05|UPDATED status: transition Finish| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2016-10-07 18:05|UPDATED status: transition Finish| # answers= 1, accepted answer= True

          People

          • Assignee:
            oriondev TID Orion Developer
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: