0

Error on YAP opensocial

Hi,

I'm getting the following error in firebug:
E is null
config()()combo?/c...KkxxQ-.js (line 28)
config()()combo?/c...KkxxQ-.js (line 28)
config()()combo?/c...KkxxQ-.js (line 28)
processNonProxiedResponse()combo?/c...KkxxQ-.js (line 28)
config()()combo?/c...KkxxQ-.js (line 28)
[Break on this error] var gadgets={};var gadgets=gadgets||{};g...tem(E,G?null:this.processData(H),G,F)}};

which traces back to a line in the code that begins with:
(function(){var E=YAHOO.namespace("yap.opensocial");var F=function(J,K){ ......

The code where this happens used to work 2 days ago and was not changed since.

by
5 Replies
  • Hi BenB,

    Thanks for your post. I just ran this opensocial code adapted from an example in the YAP docs (http://developer.yahoo.com/yap/guide/examples/gifts.txt):

    <div id="output"></div>
    <script>
    function loadFriends() {
    var req = opensocial.newDataRequest();

    // YAPNOTE: For Person requests, specify a string ID as the first argument:
    // req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
    // Although that code would work, the semantically correct way is to use IdSpec.PersonId when possible:
    req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER), 'viewer');


    // YAPNOTE: For fetch People and AppData requests, specify an IdSpec object (not a string ID) as the first argument.
    // In 0.7, VIEWER_FRIENDS is no longer available. Instead, use NETWORK_DISTANCE
    // Therefore, this code:
    // req.add(req.newFetchPeopleRequest('VIEWER_FRIENDS'), 'viewerFriends');
    // req.add(req.newFetchPersonAppDataRequest('VIEWER', 'gifts'), 'data');
    // req.add(req.newFetchPersonAppDataRequest('VIEWER_FRIENDS', 'gifts'), 'viewerFriendData');
    // is now:
    var idSpec = opensocial.newIdSpec();
    idSpec.setField(opensocial.IdSpec.Field.USER_ID, opensocial.IdSpec.PersonId.VIEWER);
    // var idSpecFriends = opensocial.newIdSpec();
    // idSpecFriends.setField(opensocial.IdSpec.Field.USER_ID, opensocial.IdSpec.PersonId.VIEWER);
    // idSpecFriends.setField(opensocial.IdSpec.Field.NETWORK_DISTANCE, 1); // YAPNOTE: Groups aren't supported in YAP v1. If you don't specify one, we assume you want friends

    // req.add(req.newFetchPeopleRequest(idSpecFriends), 'viewerFriends');
    // req.add(req.newFetchPersonAppDataRequest(idSpec, 'gifts'), 'data');
    // req.add(req.newFetchPersonAppDataRequest(idSpecFriends, 'gifts'), 'viewerFriendData');

    req.send(onLoadFriends);
    }

    function onLoadFriends(data) {
    var viewer = globalViewer = data.get('viewer').getData();
    document.getElementById('output').innerHTML = viewer.getDisplayName();
    // var viewerFriends = data.get('viewerFriends').getData(); //
    // var giftData = data.get('data').getData();
    // var viewerFriendData = data.get('viewerFriendData').getData();
    // var friends = new Array();

    // YAPNOTE: Be sure to use 'var' whenever appropiate when working in Caja
    // Therefore, this code:
    // html = new Array();
    // should be:
    // var html = new Array();
    // html.push('<select id="person">');
    // viewerFriends.each(function(person) {
    // html.push('<option value="' + person.getId() + '">' + person.getDisplayName() + "</option>");
    //
    // friends[person.getId()] = person.getDisplayName();
    // });
    // html.push('</select>');
    // document.getElementById('friends').innerHTML = html.join('');

    // globalFriends = friends;
    // updateGiftList(viewer, giftData, friends);
    // updateReceivedList(viewer, viewerFriendData, viewerFriends);
    }

    function init() {
    loadFriends();
    // makeOptionsMenu();
    }

    gadgets.util.registerOnLoadHandler(init);

    </script>


    I'm using FF 3 on a mac (10.5) and i didn't see the error you described. To help debug the problem, please post back w/ the following:
    - some code that reproduces the problem
    - the FF version and OS you're using

    Thanks again,

    Erik

    QUOTE (BenB @ Jan 29 2009, 02:57 AM) <{POST_SNAPBACK}>
    Hi,

    I'm getting the following error in firebug:
    E is null
    config()()combo?/c...KkxxQ-.js (line 28)
    config()()combo?/c...KkxxQ-.js (line 28)
    config()()combo?/c...KkxxQ-.js (line 28)
    processNonProxiedResponse()combo?/c...KkxxQ-.js (line 28)
    config()()combo?/c...KkxxQ-.js (line 28)
    [Break on this error] var gadgets={};var gadgets=gadgets||{};g...tem(E,G?null:this.processData(H),G,F)}};

    which traces back to a line in the code that begins with:
    (function(){var E=YAHOO.namespace("yap.opensocial");var F=function(J,K){ ......

    The code where this happens used to work 2 days ago and was not changed since.
    0
  • Hi,

    Thank you for your reply

    I have tried your sample code, and I'm getting a different error.
    The friend list loads OK ( as in my app ), but when trying to set app data (give a gift) I get the following error:

    QUOTE
    G is null
    [Break on this error] var gadgets={};var gadgets=gadgets||{};g...tem(E,G?null:this.processData(H),G,F)}};


    I'm using FF3 on Vista
    0
  • Hi Ben,

    Thanks for specifying the error and your browser/OS. I'm working on getting a vista image, but in the meantime, this example (http://code.google.com/apis/opensocial/docs/0.8/devguide.html#Persistent) from the opensocial docs successfully gets and sets social data for me in FF3 on Win XP:

    <script type="text/javascript">
    gadgets.util.registerOnLoadHandler(populateMyAppData);
    var htmlout = "";
    var me = null;

    /**
    * Set user data
    */
    function populateMyAppData() {
    var req = opensocial.newDataRequest();
    var data1 = Math.random() * 5;
    var data2 = Math.random() * 100;
    var data3 = new Date().getTime();
    htmlout += "Setting AppField1 to " + data1 + "<br />";
    req.add(req.newUpdatePersonAppDataRequest("VIEWER", "AppField1", data1)) + "<br />";
    htmlout += "Setting AppField2 to " + data2 + "<br />";
    req.add(req.newUpdatePersonAppDataRequest("VIEWER", "AppField2", data2)) + "<br />";
    htmlout += "Setting AppField3 to " + data3 + "<br />";
    req.add(req.newUpdatePersonAppDataRequest("VIEWER", "AppField3", data3)) + "<br />";
    req.send(handlePopulateMyAppData);
    }

    /**
    * Handle responses from update person app data requests
    */
    function handlePopulateMyAppData(data) {
    if (data.hadError()) {
    htmlout += data.getErrorMessage();
    }
    requestMyData();
    }

    /**
    * Fetch app data
    */
    function requestMyData() {
    var req = opensocial.newDataRequest();
    var fields = [ "AppField1", "AppField2", "AppField3" ];
    var p = {};

    p[opensocial.IdSpec.Field.USER_ID] = "VIEWER"; // note: extra '[]' removed from example
    var idSpec = opensocial.newIdSpec(p);
    req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER), "viewer");
    req.add(req.newFetchPersonAppDataRequest(idSpec, fields), "viewer_data");
    req.send(handleRequestMyData);
    }

    /**
    * Handle responses from app data requests
    */
    function handleRequestMyData(data) {
    var mydata = data.get("viewer_data");
    var viewer = data.get("viewer");
    me = viewer.getData();

    if (mydata.hadError()) {
    htmlout += data.getErrorMessage();
    return;
    }
    // Do something with the returned data - note the getData call
    doSomethingWithMyData(mydata.getData());
    }

    /**
    * Operate on user data
    */
    function doSomethingWithMyData(data) {
    //Data is indexed by user id, and represents an object where keys
    //correspond with the app data fields.
    var mydata = data[me.getId()];
    var div = document.getElementById('content_div');
    htmlout += "My AppField1 data is: " + mydata["AppField1"] + "<br />";
    htmlout += "My AppField2 data is: " + mydata["AppField2"] + "<br />";
    htmlout += "My AppField3 data is: " + mydata["AppField3"] + "<br />";
    div.innerHTML = htmlout;
    }

    </script>
    <div id="content_div"></div>


    If you specify some code that causes the error you're seeing, I'm happy to look through it.

    Thanks,

    Erik


    QUOTE (BenB @ Feb 9 2009, 02:07 AM) <{POST_SNAPBACK}>
    Hi,

    Thank you for your reply

    I have tried your sample code, and I'm getting a different error.
    The friend list loads OK ( as in my app ), but when trying to set app data (give a gift) I get the following error:



    I'm using FF3 on Vista
    0
  • Hi,

    Thanks for your reply.
    Your last sample does work well for me. However, when I try to add one of the following, I still get an error:

    CODE
    var idSpecOwnerFriends = opensocial.newIdSpec({ "userId" : "OWNER", "groupId" : "FRIENDS" });		
    req.add(req.newFetchPeopleRequest(idSpecOwnerFriends),'owner_friends');


    CODE
    req.add(req.newFetchPeopleRequest('OWNER_FRIENDS'),'owner_friends');
    0
  • QUOTE (BenB @ Feb 15 2009, 04:08 AM) <{POST_SNAPBACK}>
    Hi,

    Thanks for your reply.
    Your last sample does work well for me. However, when I try to add one of the following, I still get an error:

    CODE
    var idSpecOwnerFriends = opensocial.newIdSpec({ "userId" : "OWNER", "groupId" : "FRIENDS" });		
    req.add(req.newFetchPeopleRequest(idSpecOwnerFriends),'owner_friends');


    CODE
    req.add(req.newFetchPeopleRequest('OWNER_FRIENDS'),'owner_friends');


    Hey BenB,

    The newFetchPeopleRequest method requires an IdSpec object, so the second code sample won't work.

    Our social platform currently doesn't have the concept of groups, only your friends (connections). In order to retrieve your friends, use network distance:

    CODE
    var id = opensocial.newIdSpec();
    id.setField(opensocial.IdSpec.Field.USER_ID, opensocial.IdSpec.PersonId.OWNER);
    id.setField(opensocial.IdSpec.Field.NETWORK_DISTANCE, 1);
    req.add(req.newFetchPeopleRequest(id), 'owner_friends');


    We only support a network distance of 0 (default) and 1, representing the same person or your immediate friends.
    0

Recent Posts

in YAP