Details
-
Type: Monitor
-
Status: Closed
-
Priority: Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: 2021
-
Component/s: FIWARE-TECH-HELP
-
Labels:
-
HD-Chapter:Data
-
HD-Enabler:Orion
Description
Created question in FIWARE Q/A platform on 07-10-2016 at 10:10
Please, ANSWER this question AT https://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 http://$(server):1026/v1/subscribeContext s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -H 'FIWARE-Service: default' -H 'FIWARE-ServicePath: /' -d @ <<EOF
{
"entities": [
],
"attributes": [
"temperature",
"humidity"
],
"reference": "http://$(server):8666/notify",
"duration": "P1M",
"notifyConditions": [
],
"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 http://$(server):1026/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": [
],
"condition":
},
"notification": {
"httpCustom": {
"url": "http://$(server):8666/notify",
"headers":
},
"attrs": [
"temperature",
"humidity"
]
},
"expires": "2018-04-05T14:00:00.00Z",
"throttling": 5
}
EOF
This way, the STH server does not compliant about the headers, although 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}
2017-05-22 21:09|UPDATED status: transition Finish| # answers= 1, accepted answer= True