-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Cannot read property 'map' of undefined" in Notes.js after unhandled server error #51
Comments
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.
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. |
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!
The text was updated successfully, but these errors were encountered: