data.aggregate(query) error

3 posts, 1 answers
  1. Ignacio
    Ignacio avatar
    19 posts
    Member since:
    Feb 2013

    Posted 23 Jan Link to this post

    Hi there,

    My function nFac() don't works because I have changed the permissions of the table servicios to Private, returning this error:

    {"message":"READ access on type 'servicios' denied for anonymous user.","code":603}

    Thanks.
    My code:

    ---------------------------------------------------------

    function nFac() {
     
        var el = new Everlive('7y...lk');
        var data = el.data('servicios');
        var query = new Everlive.AggregateQuery();
     
        query.sum('registro', 'fra'); 
        
        return data.aggregate(query)
            .then(function(data) {
                    var s = JSON.stringify(data);
                    var j = JSON.parse(s);
                    return j.result[0].fra;
                },
                function(error) {
                    alert(JSON.stringify(error));
                });
    }

  2. Answer
    Preslav
    Admin
    Preslav avatar
    205 posts

    Posted 26 Jan Link to this post

    Hello Ignacio,

    Generally speaking, you should have only one instance of Everlive in an app.

    This faulty behavior happens because the server cannot find any logged in users in the instance created in the nFac function. In order to fix this, you will need to aggregate the data for the servicios table from the same instance of the Everlive where the user is logged in. In other words, do not create a new instance of Everlive in the nFac function and use the one with the user.

    Additionally, I'd suggest checking our Data and Authentication Hybrid tutorial. In this tutorial, you will create an app with a private list of groceries for the registered users.

    Regards,
    Preslav
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Ignacio
    Ignacio avatar
    19 posts
    Member since:
    Feb 2013

    Posted 27 Jan in reply to Preslav Link to this post

    Thank you !
Back to Top