fix: undefined properties and removed colon in print statement#486
fix: undefined properties and removed colon in print statement#486Simplyalex99 wants to merge 0 commit intoreactiflux:mainfrom
Conversation
The issue happens on each new post and is not exclusive to messages without description. Have you managed to reproduce the issue in testing server? |
Yes, in the test server fetchStarterMessage throws an error since forums don't count as having a parent message. This method only works for non-forum channels. The solution I proposed fixes this. |
|
Your |
|
Updated! And apologies, I couldn't replicate the issue of an error on every post on production a couple days ago but now I am seeing it for every post on bot log. The issue reproduction I wrote was a case that caused this to happen on both local and production when I first tried it, but I did get an error for every forum post locally, just I couldn't make it happen on production, so wasn't sure. |
|
I think the issue is with the way we are using - await retry(thread.fetchStarterMessage);
+ await retry(() => thread.fetchStarterMessage()); |
c769e89 to
afaf0a5
Compare
|
After testing, it does appear to be a context issue of losing this without passing a callback. |
Summary
Switched from fetchStarterMessage to just fetching the first message in the thread and checking for any attachments or content before sending a bot response. In addition, added a retry in case of race conditions. Also removed colon from print statement for better readability.
Issue
The error Cannot read properties of undefined (reading 'parent') originated from fetchStarterMessage when a forum post is made.
Solution
However, after care analysis, the fetchStarterMessage seems to only apply for non-forum channels as forums are different and do not have a parent id post, unlike normal threads when tested in development. For this reason, the fetchStarterMessage was removed for now.