-
Notifications
You must be signed in to change notification settings - Fork 265
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
NGSIv2 Notifications not including the Fiware-Service header for sth comet #3540
Comments
It would be great to know exactly which notification is Orion sending to STH. In order to do that just kill the STH process and start a listening process on the same port (e.g. |
First attempt without any addtional headers:
So the fiware-service-path is sent, but not the required When I add a 'fiware-service' header with value 'something' I don't receive any data. This is probaly because I don't have a fiware-service or service-path defined in orion. |
How Orion is running (i.e. |
Inside a docker container:
|
Thanks for the information! I can try to reproduce the case. You have provided me the curl you use to create the subscription and the way you run CB. Finally, could you provide me the update you are using to trigger notifications (in curl format), please? |
Hi,
I attached the relevant parts of the docker-compose files. services:
mongo-db:
image: mongo:3.6
hostname: mongo-db
container_name: db-mongo
#
# ports:
# - "27017:27017"
networks:
- default
command: --bind_ip_all --smallfiles
volumes:
- mongo-db:/data
restart: always
orion:
image: fiware/orion:2.2.0
hostname: orion
container_name: fiware-orion
depends_on:
- mongo-db
networks:
- default
ports:
- "1026:1026"
command: -dbhost mongo-db -logLevel ERROR -noCache -corsOrigin __ALL -reqMutexPolicy none
healthcheck:
test: curl --fail -s http://orion:1026/version || exit 1
restart: always
sth-comet:
image: fiware/sth-comet:2.6.0
hostname: sth-comet
container_name: fiware-sth-comet
depends_on:
- mongo-db
networks:
- default
ports:
- "8666:8666"
environment:
- STH_HOST=0.0.0.0
- STH_PORT=8666
- DB_PREFIX=sth_
- DB_URI=mongo-db:27017
- LOGOPS_LEVEL=DEBUG
restart: always
volumes:
mongo-db: ~ |
Others notifications apart from initial notification also have the same problem? Or are they working fine including the fiware-service header? |
I tested an update operation, e.g. changed the attribute of an entity with a PATH operation and I do get the same error:
The entity update PATCH operation:
Running nc shows the following output when I execute the PATCH operation:
|
Thanks you for the feedback! I'll try to reproduce the case based in your information and report my findings here. |
I have done the following tests: Start CB with the same parametrization (except my DB runs in localhost) and a fresh DB (i.e. no
Check version is as expected:
Create entity in service "something" and subservice "/":
Create subscription. Note the curl statement is same as yours, except url which point to localhost nc listening process.
I get at nc:
Now updating the entity using PATCH. Note that the curl statement is same as yours except this actually included the fiware-service and fiware-service path headers (I understand their omissing is a typo in your curl):
I get at nc:
In both cases the nc output shows the expected result, i.e. with fiware-service and fiware-servicepath headers. Thus, I'm afraid I'm not able to reproduce the problem. What I'd suggest is you to try to reproduce exactly the same "test script" (starting with a fresh DB and without any proxy or whatever extra element... I mean, just CB, mongo, nc and curl) to check if you get the same result. Maybe in that process we can have some insight of what can be going on. |
Try creating a subscription and an entity with no fiware service header. |
Ok... now I think I understand what you mean from the beginning :) Let me try to explain how Orion works.
This behaviour is consistent and make sense in the most of the cases (if Orion doesn't know the service, he cannot make it up). However, it happens that some of the Context Providers to which Orion sends context information may require fiware-service as mandatory information (and STH is one of those). Thus, in this situation there are two alternatives:
The cheaper option uses to be number 1. |
Ah okay, now I understand as well. From my point of view that sth-comet should ignore the header if it's not present or use a default one as perseo. I modified my application to now send the header, still think it's some kind of workaround. Makes it harder to quick test things in the browser |
Although Orion allows it, not using fiware-service header is an anti-pattern. It has drawbacks, i.e. you cannot evolve your application to use the FIWARE security framework, as this security framework needs fiware-service (along with fiware-servicepath and x-auth-token) to work. I'd recommend you to use Postman to do quick testing. It is almost as easiest to use as a browser :) and very much powerful. |
Having clarified the way Orion works, I think this issue can be closed. Do you agree @Siedlerchr ? (Maybe a new issue could be created in fiware-sth repository about the implementation of a default service and subservice, as Perseo does) |
Thanks for the clarification again. I now use a fiware service header and it's fine. I just thought that this header is part of a specification across all services. |
I stumbled across a bug which prevents me from creating a STH comet subscription. The issuie is similar to the old NGSIv1 related issue #2584
I am trying to create a subscription for STH comet with the NGSIv2 subscription format using
NGSIv2 legacy attributes.
STH-Comet version 2.6.0 and orion 2.2.0.
I created the minimal setup without cygnus.
Both are running from docker on the same server and are accessible from the outside.
It neither works when I pass the fiware-service header and fiware-service, it doesn't matter if it's present or not.
The text was updated successfully, but these errors were encountered: