Start a new topic

DataStore Fetch relations with Query Support, Kinvey 1.1.8 upgrade

Hi, Ive been using Kinvey 1.1.8 (angularJS) and this piece of code has been working just fine:

var query = new $kinvey.Query();

query.equalTo('item_category', 'Books')

query.descending('_kmd.ect')

var promise = $kinvey.DataStore.find('allItems', query, {relations : {more_info : 'BooksDetails'}});

return promise;


But it no longer works from Kinvey 1.1.9 upwards... it now returns error: collection name undefined.


has anyone experienced this? any ideas where I can start troubleshooting?


Thanks for the feedback.


Hey Guys, I don't have any hooks. I set debug var to false and this is the error i receive:

Object {name: "InvalidIdentifier", description: "The collection name has an invalid format.", debug: "The collection name must be a string containing on…numeric characters and dashes, "undefined" given."}

debug: "The collection name must be a string containing only alphanumeric characters and dashes, "undefined" given."description: "The collection name has an invalid format."name: "InvalidIdentifier"


This is my request.


var query = new $kinvey.Query();

query.equalTo('item_category', 'Books')

query.descending('_kmd.ect')

var promise = $kinvey.DataStore.find('MixedContent', query, {relations : {more_info : 'BooksDetails'}});

return promise;


the data does return because the debug log provides the following details:

the "data" object has the data. data.result --> is an array of length 78


I may also add that this problem persists whether I request data with relations or not.


["The network request completed.", Object]

  1. 0"The network request completed."
  2. 1Object
    1. configObject
    2. dataObject
      1. headersObject
      2. resultArray[78]
      3. __proto__Object
    3. headersfunction (c){a||(a=Xc(b));return c?(c=a[Q(c)],void 0===c&&(c=null),c):a}
    4. status200
    5. statusText"OK"

Certainly.   I will keep this post updated with updates from that engineer.   I have opened a Jira ticket that will hopefully be addressed in this sprint.   


Thanks,

Hey Lawrence,


I am an JavaScript engineer at Kinvey and I have been taking a looking at the issue you are having. Sorry for the issue you are having but if you wouldn't mind doing something for me to help me determine the cause of your issue I would appreciate it.


First upgrade to the latest version of the JavaScript library. Right now that is version 1.3.2. In your index.html set the KINVEY_DEBUG flag to true to turn on debug mode for the JavaScript library. You can just copy and paste the script below into the <head></head> tags on your index.html file.


<script type="text/javascript">

var KINVEY_DEBUG = true;

</script>


Then please execute the request that is giving you trouble and reply back with the output from the console containing the additional log statements.


Thanks

Hello Lawrence, 


I apologize for the long delay, let me pass this on to our angular engineer and have him test against it.


Thanks,

Thanks Damien, I look forward to the response.

Hi, Sorry I haven't seen your comments, this new forum does not send notifications? I'm going to follow your request above and get back to you. thank you for the feedback.

Hi, I went back to version 1.1.8 and everything works as expected. As soon I replace the Kinvey script with anything above 1.1.8 my query with relations no longer works so something must be different.


Lawrence, you can select to "Follow" a topic (near the top) if you do, you should see emails when someone else posts.


Thanks,

Hi Lawrence,


What call in the JavaScript library are you making to initiate the request?

Hi Thomas, as per your request, the logs are generated by the latest library(angularJS) 1.3.2


Looking at the request results, I can see the data with the relational data I requested so it seems Kinvey fulfils the request but things fail on the JS script. here is the request with result expanded and one of the items expanded to show that relational data is there:


  1. 0"The network request completed."
  2. 1Object
    1. configObject
    2. dataObject
      1. headersObject
        1. X-Kinvey-Request-Id"d20b4782f4b64010bf50a398562d8595"
        2. __proto__Object
      2. resultArray[12]
        1. 0Object
        2. 1Object
        3. 2Object
        4. 3Object
          1. _aclObject
          2. _id"5541fcf430612bf95402cc09"
          3. _kmdObject
          4. seed_category"Music"
          5. seed_img"http://api.deezer.com/album/7451799/image?size=big"
          6. seed_moreObject
            1. _aclObject
            2. _id"5541fcf34f6d8068740355c3"
            3. _kmdObject
            4. seed_deezerArtist1105391
            5. seed_deezerId7451799
            6. __proto__Object
          7. seed_subdue"Music"
          8. seed_subtitle"Bethel Music"
          9. seed_title"Tides Live"
          10. seed_type"Treasure Find"
          11. __proto__Object
        5. 4Object


  3. Thank You

Hi Lawrence,


That is helpful. The error received in your previous reply on Wednesday, May 13 at 9:07 am stated that the library expected to receive an array of entities as a response to the request but instead received a single entity. Looking at your response it does appear that the response is a single object. Is that true? If this is the case, I am assuming there is some custom business logic (aka hook) setup in the console to send the response back in the format presented above. The business logic (aka hook) needs to send the response as an array instead of a single object. That should resolve the error you are receiving with the JavaScript library.


Thomas.

Interesting,


I don't see any changes to query in the library.   This should be working.   Can you ensure that your code works in 1.1.8 and that the query works properly for you?


Thanks,

Hi Thomas, here is the error thrown by the debug mode:


There are a number of log statements, Do you need them all? I can create them into a file an attach if need be...


0: "Retrieving documents by query."1: Arguments[3]0: "dlseeds"1: Kinvey.Query_fields: Array[0]_filter: Objectseed_category: "Music"__proto__: Object_limit: 20_parent: null_skip: 0_sort: Object_kmd.ect: -1__proto__: Object__proto__: Object2: Object_originalRequest: ObjectattemptMICRefresh: trueclientAppVersion: undefinedcustomRequestProperties: Objectexclude: Array[0]fallback: trueoffline: undefinedrefresh: truerelations: Objectseed_more: "DeezerData"__proto__: Objecttrace: true


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


0: "Initiating a read request."1: Arguments[2]0: Objectauth: function () {collection: "dlseeds"flags: Object_: "ikcbxl2l4ujcq5mi"kinveyfile_tls: truelimit: 20query: Objectresolve: "seed_more"retainReferences: falsesort: Object__proto__: Objectlocal: Objectreq: trueres: true__proto__: Objectmethod: "GET"namespace: "appdata"


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


0: "Initiating a network request."1: "GET"2: "https://baas.kinvey.com/appdata/kid_eTOxOnyFcM/dlseeds/?kinveyfile_tls=true&retainReferences=false&resolve=seed_more&query=%7B%22seed_category%22%3A%22Music%22%7D&limit=20&sort=%7B%22_kmd.ect%22%3A-1%7D&_=ikcbxl2l4ujcq5mi"3: Object4: ObjectAccept: "application/json"Authorization: "Kinvey 47bc3f5c-6973-4aad-8650-b1cfb629f203.v/7Fh0CizLV6Dk/q/Sb7I6aa/ZR29s1gg6X6/AxMchM="X-Kinvey-API-Version: "3"X-Kinvey-Device-Information: "js-angular/1.3.2 (angularjs/1.3.13) safari 600.1.4 macintel unknown"X-Kinvey-Force-Debug-Log-Credentials: "true"X-Kinvey-Include-Headers-In-Response: "X-Kinvey-Request-Id"X-Kinvey-Origin: "http://localhost:8000"X-Kinvey-ResponseWrapper: "true"X-Kinvey-Trace-Request: "true"__proto__: Object5: Object_originalRequest: ObjectattemptMICRefresh: trueclientAppVersion: undefinedcustomRequestProperties: Objectexclude: Array[0]fallback: trueoffline: undefinedrefresh: truerelations: Objectseed_more: "DeezerData"__proto__: Objecttrace: true__proto__: Objectlength: 6


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


Expected an array of entities as a response to GET https://baas.kinvey.com/appdata/kid_eTOxOnyFcM/dlseeds/?kinveyfile_tls=true&retainReferences=false&resolve=seed_more&query=%7B%22seed_category%22%3A%22Music%22%7D&limit=20&sort=%7B%22_kmd.ect%22%3A-1%7D&_=ikcbxl2l4ujcq5mi. Received a single entity instead.

Login or Signup to post a comment