question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EddieBot crashes

See original GitHub issue

Description

EddieBot crash shows the error below

/root/EddieBot/dist/messageReactionAdd.js:49
    if (reaction.message.member.partial) {
                                ^

TypeError: Cannot read property 'partial' of null
    at Object.exports.messageReactionAdd (/root/EddieBot/dist/messageReactionAdd.js:49:33)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
AllanRegushcommented, Feb 10, 2021

Static analysis is not perfect. As per the typescript release notes

The ! non-null assertion operator is simply removed in the emitted JavaScript code.

The transpiled code does not have this check. From dist/messageReactionAdd.js

    if (reaction.message.member.partial) {
        try {
            await reaction.message.member.fetch();
        }
        catch (error) {
            logger_1.log.error('Something went wrong when fetching the member: ', error);
            return;
        }
    }

If we wish to have this null check during runtime - we have to explicitly add that in. We can see if reaction.message.member is truthy. In TypeScript

  if (reaction.message.member && reaction.message.member!.partial) {
    try {
      await reaction.message.member!.fetch();
    } catch (error) {
      log.error('Something went wrong when fetching the member: ', error);
      return;
    }
  }

The transpiled JavaScript code

    if (reaction.message.member && reaction.message.member.partial) {
        try {
            await reaction.message.member.fetch();
        }
        catch (error) {
            logger_1.log.error('Something went wrong when fetching the member: ', error);
            return;
        }
    }

Adding this check fixes the error.

1reaction
eddiejaoudecommented, Feb 16, 2021

Great team work everyone 👍 - I think there are more crash issues in the log, but this is a great start 💪

Read more comments on GitHub >

github_iconTop Results From Across the Web

API version command crashes bot · Issue #567 - GitHub
Need to check Kubernetes logs to understand why it causes the bot to crash (works locally with the prod API)
Read more >
How to Fix Server Overload & Crashes Due to Bad Bot Traffic
Learn how bad bot traffic can cause server overload, ruin your customer experience, and increase your cloud bill—and what you can do to ......
Read more >
Eddie evade bot | TikTok Search
eddie..bot. eddie..bot. 96 followers · 1 videos · beavlsz. beatriz ... هكذا كانت نهاية زيارة الاربعين. Fortnite athena crash ...
Read more >
F1 - Six wins in seven races leaves Lewis Hamilton just two short of ...
As evidenced by Alonso's accident in Aus, they know if they crash they will survive. Imagine knowing that if you ... Eddie Bot,...
Read more >
Untitled
Safe and sound remix hardwell, 195 accident maryland, Kucuk aga izle 12 bolum, Alan shortall ... Pc wall mount kit, Ros eddie bot,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found