Creating NGSI Source subscription in wirecloud mashup - fiware

I must admit I'm missing some points in creating an NGSI Source subscription for a wirecloud mashup. I tried the Wirecloud Basic History Info tutorial, tried my own deployed instance of Orion CB, tried creating subscription for both Manchester and Eindhoven cities' orion endpoint but nothing actually work: Here's the attempts I made for each case:
Wirecloud User Guide Basic Tutorial (History Info -settings created as described here):
NGSI server URL: http://orion.lab.fiware.org:1026/
NGSI proxy URL: https://ngsiproxy.lab.fiware.org
Use the FIWARE credentials of the user: Enabled
Use the FIWARE credentials of the workspace owner: Disabled
NGSI tenant/service: Emtpy
NGSI scope: /
NGSI entity types: Node, AMMS, Regulator
Id pattern: Empty
Monitored NGSI attributes: Latitud, Longitud, presence, batteryCharge, illuminance, ActivePower, ReactivePower, electricPotential, electricalCurrent
Unfortunately, after adding the NGSI Entity to PoI and creating settings as described in the Guide, PoI are not displayed on map as it is on the guide. Instead, I get the following error (NGSI Source operator logs):
Error creating subscription in the context broker server: Unexpected response from WireCloud's proxy
2. Own instance of Orion CB:
Added the following settings to the NGSI Source operator (NB: my orion instance is hosted by server ip 193.136.xx.xx):
NGSI server URL: http://193.136.xx.xx:53149/
NGSI proxy URL: https://ngsiproxy.lab.fiware.org
FIWARE-Service: urbansense
FIWARE-SERvicePath: /basic
NGSI Entity types: WeatherObserved
Monitored NGSI Attributes: location, temperature, relativeHumidity
I then get following error as well:
Error creating subscription in the context broker server: Connection Error
What exactly am i doing wrong here please?
EDIT: Using own instance of the NGSI-proxy:
NGSI server ULR http://193.136.29.17:53149/
NGSI proxy URL: http://127.0.0.1:3000
FIWARE-Service urbansense
FIWARE-ServicePath /basic
NGSI entity types WeatherObserved
Monitored NGSI attributes location, temperature, relativeHumidity
Howver, the error still remains:
Error creating subscription in the context broker server: Connection Error
Checking entities/attributes availability:
$curl -H 'fiware-service: urbansense' -H 'fiware-servicepath: /basic' http://193.136.29.17:53149/v2/entities
[{"id":"001","type":"WeatherObserved","dateObserved":{"type":"Text","value":"2014-06-05T21:47:06+01:00","metadata":{}},"illuminance":{"type":"Number","value":2.80323,"metadata":{}},"location":{"type":"StructuredValue","value":{"coordinates":[-8.594765,41.178296]},"metadata":{}},"name":{"type":"Text","value":"FEUP I322 Shannon","metadata":{}},"relativeHumidity":{"type":"None","value":null,"metadata":{}},"temperature":{"type":"None","value":null,"metadata":{}}},{"id":"003","type":"AirQualityObserved","O3":{"type":"Number","value":2.48661,"metadata":{}},"dateObserved":{"type":"Text","value":"2014-06-05T20:34:06+01:00","metadata":{}},"location":{"type":"StructuredValue","value":{"coordinates":[-8.594765,41.178296]},"metadata":{}},"name":{"type":"Text","value":"FEUP I322 Shannon","metadata":{}},"particles":{"type":"None","value":null,"metadata":{}}},{"id":"002","type":"NoiseLevelObserved","dateObserved":{"type":"Text","value":"2016-05-27T07:28:44+01:00","metadata":{}},"location":{"type":"StructuredValue","value":{"coordinates":[-8.590856,41.162781]},"metadata":{}},"measurand":{"type":"Number","value":67.7,"metadata":{}},"name":{"type":"Text","value":"Testbed Velasquez","metadata":{}},"sonometerClass":{"type":"Number","value":1,"metadata":{}}}]
NGSI-proxy log:
$ ngsi-proxy
ngsi-proxy server listening on port 3000
::ffff:127.0.0.1 - - [23/May/2019:10:58:26 +0000] "OPTIONS /eventsource HTTP/1.1" 204 - "http://193.136.xx.xx:53152/arilwan/urbansense-history-info" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36"
Created connection with id: b0eb3540-7d49-11e9-8abb-f5559f5e609e
::ffff:127.0.0.1 - - [23/May/2019:10:58:26 +0000] "POST /eventsource HTTP/1.1" 201 135 "http://193.136.xx.xx:53152/arilwan/urbansense-history-info" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36"
::ffff:127.0.0.1 - - [23/May/2019:10:58:26 +0000] "OPTIONS /callbacks HTTP/1.1" 204 - "http://193.136.xx.xx:53152/arilwan/urbansense-history-info" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36"
Created callback with id: b1039f40-7d49-11e9-8abb-f5559f5e609e
::ffff:127.0.0.1 - - [23/May/2019:10:58:26 +0000] "POST /callbacks HTTP/1.1" 201 131 "http://193.136.xx.xx:53152/arilwan/urbansense-history-info" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36"
::ffff:127.0.0.1 - - [23/May/2019:10:58:57 +0000] "OPTIONS /callbacks/b1039f40-7d49-11e9-8abb-f5559f5e609e HTTP/1.1" 204 - "http://193.136.xx.xx:53152/arilwan/urbansense-history-info" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36"
Deleting callback b1039f40-7d49-11e9-8abb-f5559f5e609e
Deleted callback with id: b1039f40-7d49-11e9-8abb-f5559f5e609e
::ffff:127.0.0.1 - - [23/May/2019:10:58:57 +0000] "DELETE /callbacks/b1039f40-7d49-11e9-8abb-f5559f5e609e HTTP/1.1" 204 - "http://193.136.xx.xx:53152/arilwan/urbansense-history-info" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36"
NGINX error log(nginx_logs/error.log):
2019/05/23 10:57:04 [warn] 6#6: *171 upstream sent more data than specified in "Content-Length" header while reading upstream, client: 193.136.38.232, server: , request: "GET /showcase/media/CoNWeT/map-viewer/2.6.2/index.html?entrypoint=true&v=31cb4ca4c8751f6d04c4242d0b52b176a2c7bc9b&theme=wirecloud.defaulttheme HTTP/1.1", upstream: "http://192.168.224.10:8000/showcase/media/CoNWeT/map-viewer/2.6.2/index.html?entrypoint=true&v=31cb4ca4c8751f6d04c4242d0b52b176a2c7bc9b&theme=wirecloud.defaulttheme", host: "193.136.xx.xx:53152", referrer: "http://193.136.xx.xx:53152/arilwan/urbansense-history-info"
2019/05/23 10:57:34 [error] 6#6: *179 upstream prematurely closed connection while reading response header from upstream, client: 193.136.38.232, server: , request: "POST /cdp/http/193.136.xx.xx:53149/v2/subscriptions HTTP/1.1", upstream: "http://192.168.224.10:8000/cdp/http/193.136.xx.xx:53149/v2/subscriptions", host: "193.136.xx.xx:53152", referrer: "http://193.136.xx.xx:53152/arilwan/urbansense-history-info"

You're not making anything wrong, provided that on the chosen Context Broker, with that tenant ID (FIWARE-Service) and on that Service Path, there exist such Entity Types.
But the connection error is not due to your Context Broker instances (your own one or the public instance on FIWARE lab), but to the NGSI-proxy. The FIWARE Lab instance of NGSI-proxy (https://ngsiproxy.lab.fiware.org) seems not to be working properly. While it is reported and respawned, you can try your own instancce of an NGSI-proxy by following instructions here: https://github.com/conwetlab/ngsi-proxy.
Bear in mind that the NGSI-Source operator (I assume you're using it) uses the NGSI-Proxy for the reception of the notifications on subscriptions (the operator subscribes for any change in the monitored NGSI Attributes), and since the proxy is not working properly, the subscription fails.
Best regards

Related

Random 502 Bad gateway error using Azure application Gateway with Traefik Ingress for MultiSite

I have created an Azure application gateway WAF V2 tier, which is connected to Traefik ingress controller in AKS and the ingress forward traffic to the applications in AKS.
The backend-pool point to Treafik ingress private IP and the Http Setting and Listener have been satup for multisite.
I have also sat up HealthProbe which is tested successfully.
The timeout has been increased to 180 seconds.
Sending a get requests to app host works fine for a few minutes then it starts to give 502 bad gateway response for some seconds and later on starts to give 200 ok reponse. So as you can see it is not stable.
The moment that it gives 502 error, Backend-health and HealthProbe works fine. There are not much info in logs which you can see it here:
Application Gateway (WAF) -> Traefik Ingress Controller -> services
AzureDiagnostics | where ResourceProvider == "MICROSOFT.NETWORK" and
Category has "ApplicationGatewayAccessLog" and httpStatus_d == 502
TimeGenerated [UTC]
2021-10-08T08:05:21.533Z
ResourceId
/SUBSCRIPTIONS/.../RESOURCEGROUPS/..../PROVIDERS/MICROSOFT.NETWORK/APPLICATIONGATEWAYS/MyAPPGATEWAY
Category
ApplicationGatewayAccessLog
ResourceGroup
RG-APP-SANDBOX
SubscriptionId
......
ResourceProvider
MICROSOFT.NETWORK
Resource
MyAPPGATEWAY
ResourceType
APPLICATIONGATEWAYS
OperationName
ApplicationGatewayAccess
requestUri_s
/
userAgent_s
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0
ruleName_s
vnet-sandbox-rqrt-https
httpMethod_s
GET
instanceId_s
appgw_0
httpVersion_s
HTTP/1.1
clientIP_s
......
host_s
hellopython-aks.mydomain.io
sslEnabled_s
on
clientPort_d
52260
httpStatus_d
502
receivedBytes_d
495
sentBytes_d
366
timeTaken_d
0.004
SourceSystem
Azure
timeStamp_t [UTC]
2021-10-08T08:04:42Z
transactionId_g
.....
listenerName_s
vnet-sandbox-listener-https
backendPoolName_s
vnet-sandbox-bp
backendSettingName_s
vnet-sandbox-hts-https
originalRequestUriWithArgs_s
/
sslCipher_s
ECDHE-RSA-.....
sslProtocol_s
TLSv1.2
sslClientVerify_s
NONE
serverRouted_s
MyIngressPrivateIP:443
serverStatus_s
502
serverResponseLatency_s
0.004
originalHost_s
hellopython-aks.mydomain.io
Type
AzureDiagnostics
_ResourceId
/subscriptions/...../resourcegroups/...../providers/microsoft.network/applicationgateways/myappgateway
Does anyone know why this happens and how I can fix it?

Error 404 in Nginx reverse proxy with iframe

I've been trying to run a reverse proxy to manage a graph of Grafana in an iframe. I'm using Apache on port 80 with the html page, Grafana server on port 3000 and Nginx with the reverse proxy on 8081.
The problem is that the proxy gives me a 404 error when I try to access the contents of the iframe. To test everything, I tried a local Grafana server configuration and a remote server configuration with 2 different iframes. The one connected to the local Grafana gives me a generic error of Grafana and a 404 when uploading the file, the remote one only 404.
Obviously each link taken individually works if I insert it on the browser, and without using the proxy it works the same way on the iframe.
I am not an Nginx expert and there will probably be some errors in the configuration. As a configuration file I'm using the Nginx default.conf file, so I haven't touched the nginx.conf because I don't think I need it for this purpose.
index.html
<h4>grafana local</h4>
<iframe src="http://localhost:8081/grafana/d-solo/KXusIR0Mk/test?orgId=1&from=1606211757397&to=1606233357397&panelId=2" width="450" height="200" frameborder="0"></iframe>
<h4>grafana remote</h4>
<iframe src="http://localhost:8081/salvo/d-solo/s-kg75yZz/stazione-meteo?orgId=1&panelId=8&from=1606215708391&to=1606237308391" width="450" height="200" frameborder="0"></iframe>
default.conf
server {
listen 8081;
listen [::]:8081;
server_name 127.0.0.1;
location /grafana/ {
#rewrite (grafana\/).* d-solo/KXusIR0Mk/test?orgId=1&from=1606211757397&to=1606233357397&panelId=2 break;
proxy_pass http://localhost:3000/;
}
location /salvo/ {
#rewrite (salvo\/).* d-solo/s-kg75yZz/stazione-meteo?orgId=1&panelId=8&from=1606215708391&to=1606237308391 break;
proxy_pass http://<ip_remoteGrafana>:<port>/;
}
}
PS: the ip and the port of the remote Grafana are not mine so I removed them, but in the code they are there ;)
access.log
::1 - - [26/Nov/2020:14:17:41 +0100] "GET /salvo/d-solo/s-kg75yZz/stazione-meteo?orgId=1&panelId=8&from=1606215708391&to=1606237308391 HTTP/1.1" 302 29 "http://localhost/grafana/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
::1 - - [26/Nov/2020:14:17:41 +0100] "GET /login HTTP/1.1" 404 197 "http://localhost/grafana/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
error.log
2020/11/26 14:17:41 [error] 101110#101110: *1 open() "/usr/share/nginx/html/login" failed (2: No such file or directory), client: ::1, server: 127.0.0.1, request: "GET /login HTTP/1.1", host: "localhost:8081", referrer: "http://localhost/grafana/"
What is this due to?
Apparently proxied Grafana needs authentication (redirect to /login), which is not compatible with your context path (it must be /salvo/login in your case). You will need redirect/content rewrite, which fill update all path to your used context /salvo/. That's complicated and not very reliable.
But you may somehow do that, but then you may discover that target Grafana doesn't allow to be embedded in the iframe or that Grafana cookies config (e.g. samesite, secure) may be also problem for your http app or Grafana auth is a problem. I would work with simple / context first to discover issues early and later also with more complicated context paths e.g. /salvo/.

Invalid schema detected - no type or db_type element Dreamfactory

I'm using postman and dreamfactory and I get the following error message, when I send a post request to create a record in a table. I'm using MySQL as my database. I believe it could be because I haven't set up my foreign key relationships properly. How can I go about setting this up?
Invalid schema detected - no type or db_type element.
Below is the request header
General
----
Remote Address:[::1]:8080
Request
URL:http://localhost:8080/api/v2/MySQL/_schema/kartadb.country/1
Request Method:POST
Status Code:500 Internal Server Error
Response Headers
view source
Access-Control-Allow-Origin:chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
Cache-Control:no-cache
Connection:close
Content-Type:application/json
Date:Tue, 20 Oct 2015 08:17:33 GMT
Server:Apache
Transfer-Encoding:chunked
Vary:Origin
X-Frame-Options:SAMEORIGIN
X-Powered-By:PHP/5.5.29
Request Headers
----
Accept:*/*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Authorization:Basic dGV3b2Ryb3Mud3JAZ21haWwuY29tOg==
Cache-Control:no-cache
Connection:keep-alive
Content-Length:92
Content-Type:text/plain;charset=UTF-8
Host:localhost:8080
Origin:chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
Postman-Token:3f469a4f-f95a-eb1f-c5eb-8da94b110e47
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36
X-DreamFactory-Api-Key:6498a8ad1beb9d84d63035c5d1120c007fad6de706734db9689f8996707e0f7d
X-DreamFactory-Session-Token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjcsInVzZXJfaWQiOjcsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODA4MFwvYXBpXC92MlwvdXNlclwvc2Vzc2lvbiIsImlhdCI6IjE0NDUzMjY2OTQiLCJleHAiOiIxNDQ1MzMwMjk0IiwibmJmIjoiMTQ0NTMyNjY5NCIsImp0aSI6ImNlMDJiMWU1ZTRjZjc4MmZmYTYxZmYyZDM1MGNiODg2In0.F0UcNExumeAwLF-xM6SmgKktcPSprYrS7x95KFJmYI4
You mention creating a "record" in a table. The /_schema resource is for creating table schema, not records. Use the /_table resource for creating records.

Fiddler Echo Service error while accessing localhost in my chrome browser

I want to run apache-tomcat-6.0.44 server on my laptop. I have configured Classpath, Path and CATALINA_HOME variables. I am able to run the server from command prompt (using "startup" command). But the problem is, when I am typing "http://localhost:8080" in the url bar of my chrome browser and clicking enter, I am gettig error as:
Fiddler Echo Service
GET / HTTP/1.1 Host: localhost:8080 Proxy-Connection: keep-alive
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 6.1)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101
Safari/537.36 Accept-Encoding: gzip, deflate, sdch Accept-Language:
en-GB,en-US;q=0.8,en;q=0.6 Cookie: _ga=GA1.1.1441246844.1443724804 To
configure Fiddler as a reverse proxy instead of seeing this page, see
Reverse Proxy Setup You can download the FiddlerRoot certificate**
I have gone through some of the solutions, which are:
1) Fiddler Echo Service blocking oracle homepage in browser
2) Fiddler not capturing traffic from browsers
But I am still not able to fix the issue. Could anyone please help me out with this.
Along with using proxy server, Check if your Lan setting is set to detect Automatically.
Go to below section of chrome
"settings>Advanced settings>Network>Change Proxy settings" You shall get a wizard.
In there click "Lan Settings" and select the checkbox for "Automatically detect settings"
Another possibility is mismatch of crtificate installed.
server name used in Apache (httpd.conf) must be the same as the server name in apache (httpd-ssl.conf) e.g. in Apache (httpd.conf)ServerName localhost:8080 then in apache (httpd-ssl.conf) should be like this ServerName www.example.com:8080

How to debug JSON binding errors in REST

I have a Spring MVC application with a few REST interfaces exposed and is running on an Apache Tomcat instance.
I'm wondering if there are any ways to troubleshoot the data binding errors when trying to POST to an end point. So when I post some JSON I would like to find out why the data binding is failing (when Spring converts this to an object at the Controller). I might have to do some config changes to the apache server to increase the debugging level to show more info or increase the logging level in my application (log4j) to display any errors that Spring throws out. Wondering if anyone can help me find ways to debug databinding issues.
Here is the request/response log from the Chrome's dev console for the failed request. If I simplify the JSON structure, it does seem to bind but I'd like to find out which specific JSON attributes are causing the problem.
Request URL:http://localhost:8080/entryrive-service/user/6/entry/
Request Method:POST
Status Code:400 Bad Request
Request Headersview source
Accept:application/json, text/plain, */*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:667
Content-Type:application/json;charset=UTF-8
Host:localhost:8080
Origin:http://localhost:8383
Referer:http://localhost:8383/entryrive-client/app/index.html
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Request Payloadview source
{id:null, title:Sprouts Farmers Market, entryDate:1388559600000, entryPayerId:[6], notes:test,…}
entryCreaterId: null
entryDate: 1388559600000
entryItemEntry: []
entryPayerId: [6]
entrySimpleEntry: {id:null, itemDescription:null, simpleUserIdAndLiableCost:[,…]}
entryTotal: "30"
groupId: 3
id: null
notes: "test"
title: "Sprouts Farmers Market"
userId: null
Response Headersview source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:http://localhost:8383
Connection:close
Content-Language:en
Content-Length:968
Content-Type:text/html;charset=utf-8
Date:Sun, 05 Jan 2014 19:50:05 GMT
Server:Apache-Coyote/1.1
Increasing the logging level of Spring framework did seem to show up what Spring has been upto
log4j.logger.org.springframework=ALL