I have an HTML table I want to populate with values stored in the Cloudkit Dashboard.
I have successfully retrieved records and populated my tables with them, and the problem I am noticing is that if I give it some time and try to reload the table again some records will not get retrieved. I haven't changed any of my code in the time between, so I'm very puzzled as to how/why this is happening. Below is an example of my code, and the error log:
public-query.js :
records.forEach(function(record) {
var fields = record.fields;
var tableActual = "<tr><td>" + record['created'].timestamp + "</td><td>" + fields['placeName'].value + </td></tr>
document.write(tableActual)
ERROR LOG:
Uncaught (in promise) TypeError: Cannot read property 'timestamp' of undefined
at public-query.js:49:73
at Array.forEach (native)
at public-query.js:47:29
If I remove for example the <td>" + record['created'].timestamp + "</td>
then the error log will say the next <td>
is undefined.
To be clear, there is currently a record being retrieved WITH its timestamp correctly, and there were other records that were being retrieved and now aren't, with no change in code.
I've received this error at different times in different parts of line 3 (in the actual code there are 16 fields/<td>
) even though I know that those fields are populated in the record, and have also retrieved records with those fields unpopulated.
Any idea what's going on here? Is this a bug with Cloudkit or something I am doing wrong?