When climbing a thread, a deleted parent post will make the mention handler error out:
uncaught error in MENTION handler: TypeError: Cannot read properties of undefined (reading 'record')
at mapBskyFeedPostToPost (.../dist/easy-bsky-bot-sdk.js:147:33)
at mapThreadViewPostToPost (.../dist/easy-bsky-bot-sdk.js:183:12)
at .../dist/easy-bsky-bot-sdk.js:214:22
at Generator.next (<anonymous>)
at fulfilled (...dist/easy-bsky-bot-sdk.js:10:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Solving this currently by wrapping in a try/catch but probably not ideal long term.
let history: Post[] = [];
try {
history = await bot.getPostParents(post.uri);
} catch (err) {
console.error("Error getting post parents:", err);
// just add the current post to the history
history = [post];
}
When climbing a thread, a deleted parent post will make the mention handler error out:
Solving this currently by wrapping in a try/catch but probably not ideal long term.