Search code examples
fiware-orionfiwarefiware-wirecloud

ProxyConnectionError when connecting as Anonymous


I have developed an operator to retrieve information from Orion Context Broker.

It works perfectly when I'm loggin but if I try to enter as anonymous (with the embedded URL) in a incognito window, the operator raises the next error:

(link to the image): https://i.sstatic.net/jxMkr.png

Screenshot from console

This is the code:

var doInitialSubscription = function doInitialSubscription() {

        this.subscriptionId = null;

        this.ngsi_server = MashupPlatform.prefs.get('ngsi_server');
        this.ngsi_proxy = MashupPlatform.prefs.get('ngsi_proxy');
        this.connection = new NGSI.Connection(this.ngsi_server, {
            ngsi_proxy_url: this.ngsi_proxy
        });

        console.log("Send initial subscription");

        var types = ['SMARTMETER'];
        var entityIdList = [];
        var entityId;
        entityId = {
            id: '.*',
            type: 'SMARTMETER',
            isPattern: true
        };
        entityIdList.push(entityId);
        var attributeList = null;
        var duration = 'PT3H';
        var throttling = null;
        var notifyConditions = [{
            'type': 'ONCHANGE',
            'condValues': condValues
        }];
        var options = {
            flat: true,
            onNotify: handlerReceiveEntity.bind(this),
            onSuccess: function (data) {
                console.log("Subscription success ID: "+data.subscriptionId);
                this.subscriptionId = data.subscriptionId;
                this.refresh_interval = setInterval(refreshNGSISubscription.bind(this), 1000 * 60 * 60 * 2);  // each 2 hours
                window.addEventListener("beforeunload", function () {
                    this.connection.cancelSubscription(this.subscriptionId);
                }.bind(this));
            }.bind(this),
            onFailure: function(data) {
                console.log(data);
            }

        };
        console.log("Now creating subscription...");
        this.connection.createSubscription(entityIdList, attributeList, duration, throttling, notifyConditions, options);
    };

Any idea of what is wrong?


Solution

  • According to user comments on the question, updating to Orion 0.19.0 (following the DB upgrade procedure detailed here) solves the problem.