Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications not including the Fiware-ServicePath header #2584

Closed
gtorodelvalle opened this issue Oct 7, 2016 · 5 comments
Closed

Notifications not including the Fiware-ServicePath header #2584

gtorodelvalle opened this issue Oct 7, 2016 · 5 comments
Labels
Milestone

Comments

@gtorodelvalle
Copy link
Member

When subscribing the STH component to a Orion Context Broker instance (version 1.4.0) using default as the service (Fiware-Service header) and / as the service path (Fiware-ServicePath header), the notifications sent by the Context Broker do not seem to include the Fiware-ServicePath header.

The subscription requested is the following one:

curl $(orionserver):1026/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):8666/notify",
    "duration": "P1M",
    "notifyConditions": [
        {
            "type": "ONCHANGE",
            "condValues": [
                "temperature",
                "humidity"
            ]
        }
    ],
    "throttling": "PT5S"
}
EOF

Both components (Context Broker and STH) are installed in the same FIWARE Lab machine and they are accessed remotely using a public IP address.

The error message the STH component shows is the following one:


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}

When changing the used service path from / to /something everything works as expected.

Thanks!

@fgalan fgalan added this to the 1.5.0 milestone Oct 7, 2016
@fgalan
Copy link
Member

fgalan commented Oct 7, 2016

The use case where this bug was detected has solved the case with a workaround. Thus, we are labeling with a non-critical priority number.

@fgalan fgalan modified the milestones: 1.5.0, 1.6.0 Oct 28, 2016
@fgalan fgalan modified the milestones: 1.6.0, 1.7.0 Nov 28, 2016
@fgalan fgalan added this to the 1.7.0 milestone Jan 18, 2017
@fgalan
Copy link
Member

fgalan commented Jan 20, 2017

Fixed by PR #2828 (now merged in master). @gtorodelvalle do you want to try before closing the issue? The fix will be in next 1.7.0 version (by the end of January) although the docker generated from master should already have the fix.

@gtorodelvalle
Copy link
Member Author

Fine with solution ;) Thank you very much!!!

@Siedlerchr
Copy link

I am having the same error now with NGSIv2 legacy attributes and in STH-Comet version 2.6.0 and orion 2.2.0:
Both are running from docker.

requests with ERROR in the last 60s interval
time=2019-08-22T08:16:39.107Z | lvl=WARN | corr=n/a | trans=n/a | op=OPER_STH_SERVER_LOG | from=n/a | srv=n/a | subsrv=n/a | comp=STH | msg=error=child "fiware-service" fails because [fiware-service is required]
time=2019-08-22T08:16:39.109Z | lvl=WARN | corr=2a5b5150-c4b5-11e9-be70-0242ac120105 | trans=fdef8685-5a63-4012-a88d-73bc836b2e68 | op=OPER_STH_POST | from=n/a | srv=n/a | subsrv=/ | comp=STH | msg=POST /notify, event={"request":"1566461799088:sth-comet:15:jzl0yeny:10001","timestamp":1566461799108,"tags":["validation","error","headers"],"data":{"data":null,"isBoom":true,"isServer":false,"output":{"statusCode":400,"payload":{"statusCode":400,"error":"Bad Request","message":"error=child \"fiware-service\" fails because [fiware-service is required]","validation":{"source":"headers","keys":[]}},"headers":{}}},"internal":true}

It neither works when I pass the fiware-service header and fiware-service.

curl -X POST \
  http://example.com:1026/v2/subscriptions/ \
  -H 'Content-Type: application/json' \
  -H 'fiware-service: something' \
  -H 'fiware-servicepath: /' \
  -d '{
  "description": "Notify STH-Comet of all water level changes",
  "subject": {
    "entities": [
      {
        "idPattern": "WaterLevel.*"
      }
    ],
    "condition": {
      "attrs": [
      	"waterLevel"
      ]
    }
  },
  "notification": {
    "http": {
      "url": "http://example.com:8666/notify"
    },
    "attrs": [
      "waterLevel"
    ],
    "attrsFormat": "legacy"
  }
}'

@fgalan
Copy link
Member

fgalan commented Aug 22, 2019

I'd suggest to open a new fresh issue about this (this one is pretty old and closed). It should be easy, basically a copy-paste to a new issue :)

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants