Open zudljk opened 4 years ago
Hi, I am experiencing the same error, and thus trying to figure out where and what the shortGUID field is but it seems I can't find it. Trying stuff like this:
const notes = myCloud.Notes.fetch();
notes.on("data", async zone => {
....
....
console.log(myNote.fields.Note.value['recordName'])
console.log(myNote.fields.Note.value)
console.log(myNote)
}
Maybe I am on the wrong track but would like to find notes where this field is missing and filter them out as suggested. Where inside "myNote" should this field be located?
Thanks!
Hi @zudljk sorry for bothering you but this is proably an easy one for you ^
I would like to use the same workaround as you did but can't locate the shortGUID anywhere in my objects. It drive's me kind of crazy - and yes I am not too familiar with javascript - coming from python. Well anyway, maybe you could give me some heads up. Thanks in advance!
Jojo
Hi @JOJ0, sorry for the late answer, as far as I remember, the shortGUID property is directly below the note object itself. At least that's where I check for it in my own project (https://github.com/zudljk/inotes2md/blob/master/inotes2md.js)
Yes! this is exactely the answer I was looking for! I am sure it will help. I will report my findings here, it might help others too. Will take some time until I get to work on this again. Thanks a lot! :-)
When a request to resolve a note fails on the server side (e.g. 400 Bad Request), a JSON will be returned that doesn't a "results" field.
This was the payload returned from the server from at least one of the notes in my iCloud account:
Therefore, this line will produce a TypeError since result.results will be undefined:
const records = result.results.map(res => res.rootRecord).map(record => {
Exception stack trace:
The reason was that at least one of my notes fetched by myCloud.Notes.fetch() had no "shortGUID" field. Filtering out this note fixed the error for me, but there should be a general handling of Bad Request errors.
Apart from that, thanks for the great work on this project!