IanMitchell / sentrydiscord.dev

Forward Sentry notifications to your Discord server
https://sentrydiscord.dev
MIT License
209 stars 22 forks source link

Fields are undefined #2

Closed samchouse closed 3 years ago

samchouse commented 3 years ago

How can I fix this?

What happens: 2cbc567

Payload:

{
  "id": "2450576855",
  "project": "bot",
  "project_name": "bot",
  "project_slug": "bot",
  "logger": null,
  "level": "error",
  "culprit": "PingCommand.exec(bot.commands.utility:Ping)",
  "message": "",
  "url": "https://sentry.io/organizations/alph4/issues/2450576855/?referrer=webhooks_plugin",
  "triggering_rules": [
    "Send all notifications"
  ],
  "event": {
    "event_id": "39e983d6a39b451da0f2c1c7cef8c5a6",
    "level": "error",
    "version": "7",
    "type": "error",
    "fingerprint": [
      "{{ default }}"
    ],
    "culprit": "PingCommand.exec(bot.commands.utility:Ping)",
    "logger": "",
    "platform": "node",
    "timestamp": 1623427750.245,
    "received": 1623427750.355762,
    "environment": "development",
    "contexts": {
      "command_started": {
        "extra": {
          "command": "[Object]",
          "guild": "[Object]",
          "message": "[Object]"
        },
        "type": "command_started",
        "user": {
          "id": "550337381128208396",
          "username": "Xenfo#0001"
        }
      }
    },
    "breadcrumbs": {
      "values": [
        {
          "timestamp": 1623426742.164,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "GET",
            "status_code": 200,
            "url": "https://discord.com/api/v7/gateway/bot"
          }
        },
        {
          "timestamp": 1623426742.638,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "GET",
            "status_code": 200,
            "url": "https://discord.com/api/v7/guilds/794696873750953984/invites"
          }
        },
        {
          "timestamp": 1623426742.641,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "GET",
            "status_code": 200,
            "url": "https://discord.com/api/v7/guilds/601609698843820033/invites"
          }
        },
        {
          "timestamp": 1623426742.662,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "GET",
            "status_code": 200,
            "url": "https://discord.com/api/v7/guilds/845010274665889812/invites"
          }
        },
        {
          "timestamp": 1623426742.671,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "GET",
            "status_code": 200,
            "url": "https://discord.com/api/v7/guilds/701546532054237306/invites"
          }
        },
        {
          "timestamp": 1623426742.672,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "GET",
            "status_code": 200,
            "url": "https://discord.com/api/v7/guilds/685219613146873876/invites"
          }
        },
        {
          "timestamp": 1623426742.68,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "GET",
            "status_code": 200,
            "url": "https://discord.com/api/v7/guilds/712571134872387594/invites"
          }
        },
        {
          "timestamp": 1623426742.692,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "GET",
            "status_code": 200,
            "url": "https://discord.com/api/v7/guilds/749626435186196492/invites"
          }
        },
        {
          "timestamp": 1623426742.852,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "POST",
            "status_code": 200,
            "url": "https://cocdiscordlink.azurewebsites.net/api/login"
          }
        },
        {
          "timestamp": 1623426751.409,
          "type": "default",
          "category": "Utility",
          "level": "info",
          "message": "command_started",
          "data": {
            "args": {},
            "command": {
              "aliases": [
                "ping"
              ],
              "category": "Utility",
              "id": "ping"
            },
            "guild": {
              "channel_id": "724146808598560789",
              "id": "685219613146873876",
              "name": "ALPH4 Engines"
            },
            "message": {
              "content": "-ping",
              "id": "852938357947236352"
            },
            "user": {
              "id": "550337381128208396",
              "username": "Xenfo#0001"
            }
          }
        },
        {
          "timestamp": 1623426751.412,
          "type": "default",
          "category": "console",
          "level": "info",
          "message": "Error: Why are you not working?\n    at PingCommand.exec (/home/xenfo/Desktop/Projects/alph4/alph4-bot/dist/src/bot/commands/utility/Ping.js:18:15)\n    at CommandHandler.runCommand (/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js:768:39)\n    at CommandHandler.handleDirectCommand (/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js:439:31)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)\n    at async CommandHandler.handle (/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js:379:23)"
        },
        {
          "timestamp": 1623426751.579,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "POST",
            "status_code": 200,
            "url": "https://discord.com/api/v7/channels/724146808598560789/messages"
          }
        },
        {
          "timestamp": 1623426751.679,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "POST",
            "status_code": 200,
            "url": "https://discord.com/api/v7/channels/759062542621605940/messages"
          }
        },
        {
          "timestamp": 1623426751.68,
          "type": "default",
          "category": "Utility",
          "level": "error",
          "message": "command_errored",
          "data": {
            "command": {
              "aliases": [
                "ping"
              ],
              "category": "Utility",
              "id": "ping"
            },
            "guild": {
              "channel_id": "724146808598560789",
              "id": "685219613146873876",
              "name": "ALPH4 Engines"
            },
            "message": {
              "content": "-ping",
              "id": "852938357947236352"
            },
            "user": {
              "id": "550337381128208396",
              "username": "Xenfo#0001"
            }
          }
        },
        {
          "timestamp": 1623427749.922,
          "type": "default",
          "category": "Utility",
          "level": "info",
          "message": "command_started",
          "data": {
            "args": {},
            "command": {
              "aliases": [
                "ping"
              ],
              "category": "Utility",
              "id": "ping"
            },
            "guild": {
              "channel_id": "724146808598560789",
              "id": "685219613146873876",
              "name": "ALPH4 Engines"
            },
            "message": {
              "content": "-ping",
              "id": "852942546023743508"
            },
            "user": {
              "id": "550337381128208396",
              "username": "Xenfo#0001"
            }
          }
        },
        {
          "timestamp": 1623427749.922,
          "type": "default",
          "category": "console",
          "level": "info",
          "message": "Error: Why are you not working?\n    at PingCommand.exec (/home/xenfo/Desktop/Projects/alph4/alph4-bot/dist/src/bot/commands/utility/Ping.js:18:15)\n    at CommandHandler.runCommand (/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js:768:39)\n    at CommandHandler.handleDirectCommand (/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js:439:31)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)\n    at async CommandHandler.handle (/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js:379:23)"
        },
        {
          "timestamp": 1623427750.125,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "POST",
            "status_code": 200,
            "url": "https://discord.com/api/v7/channels/724146808598560789/messages"
          }
        },
        {
          "timestamp": 1623427750.242,
          "type": "http",
          "category": "http",
          "level": "info",
          "data": {
            "method": "POST",
            "status_code": 200,
            "url": "https://discord.com/api/v7/channels/759062542621605940/messages"
          }
        },
        {
          "timestamp": 1623427750.244,
          "type": "default",
          "category": "Utility",
          "level": "error",
          "message": "command_errored",
          "data": {
            "command": {
              "aliases": [
                "ping"
              ],
              "category": "Utility",
              "id": "ping"
            },
            "guild": {
              "channel_id": "724146808598560789",
              "id": "685219613146873876",
              "name": "ALPH4 Engines"
            },
            "message": {
              "content": "-ping",
              "id": "852942546023743508"
            },
            "user": {
              "id": "550337381128208396",
              "username": "Xenfo#0001"
            }
          }
        }
      ]
    },
    "exception": {
      "values": [
        {
          "type": "Error",
          "value": "Why are you not working?",
          "stacktrace": {
            "frames": [
              {
                "function": "async CommandHandler.handle",
                "module": "discord-akairo.src.struct.commands:CommandHandler",
                "filename": "/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js",
                "abs_path": "/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js",
                "lineno": 379,
                "colno": 23,
                "pre_context": [
                  "                message.util.parsed = parsed;",
                  "            }",
                  "",
                  "            let ran;",
                  "            if (!parsed.command) {",
                  "                ran = await this.handleRegexAndConditionalCommands(message);",
                  "            } else {"
                ],
                "context_line": "                ran = await this.handleDirectCommand(message, parsed.content, parsed.command);",
                "post_context": [
                  "            }",
                  "",
                  "            if (ran === false) {",
                  "                this.emit(CommandHandlerEvents.MESSAGE_INVALID, message);",
                  "                return false;",
                  "            }",
                  ""
                ],
                "in_app": false
              },
              {
                "function": "processTicksAndRejections",
                "module": "task_queues",
                "filename": "internal/process/task_queues.js",
                "abs_path": "internal/process/task_queues.js",
                "lineno": 95,
                "colno": 5,
                "in_app": false
              },
              {
                "function": "runMicrotasks",
                "in_app": true
              },
              {
                "function": "CommandHandler.handleDirectCommand",
                "module": "discord-akairo.src.struct.commands:CommandHandler",
                "filename": "/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js",
                "abs_path": "/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js",
                "lineno": 439,
                "colno": 31,
                "pre_context": [
                  "                        return true;",
                  "                    }",
                  "",
                  "                    command.locker.add(key);",
                  "                }",
                  "            }",
                  ""
                ],
                "context_line": "            return await this.runCommand(message, command, args);",
                "post_context": [
                  "        } catch (err) {",
                  "            this.emitError(err, message, command);",
                  "            return null;",
                  "        } finally {",
                  "            if (key) command.locker.delete(key);",
                  "        }",
                  "    }"
                ],
                "in_app": false
              },
              {
                "function": "CommandHandler.runCommand",
                "module": "discord-akairo.src.struct.commands:CommandHandler",
                "filename": "/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js",
                "abs_path": "/home/xenfo/Desktop/Projects/alph4/alph4-bot/node_modules/discord-akairo/src/struct/commands/CommandHandler.js",
                "lineno": 768,
                "colno": 39,
                "pre_context": [
                  "    async runCommand(message, command, args) {",
                  "        if (command.typing) {",
                  "            message.channel.startTyping();",
                  "        }",
                  "",
                  "        try {",
                  "            this.emit(CommandHandlerEvents.COMMAND_STARTED, message, command, args);"
                ],
                "context_line": "            const ret = await command.exec(message, args);",
                "post_context": [
                  "            this.emit(CommandHandlerEvents.COMMAND_FINISHED, message, command, args, ret);",
                  "        } finally {",
                  "            if (command.typing) {",
                  "                message.channel.stopTyping();",
                  "            }",
                  "        }",
                  "    }"
                ],
                "in_app": false
              },
              {
                "function": "PingCommand.exec",
                "module": "bot.commands.utility:Ping",
                "filename": "/home/xenfo/Desktop/Projects/alph4/alph4-bot/dist/src/bot/commands/utility/Ping.js",
                "abs_path": "/home/xenfo/Desktop/Projects/alph4/alph4-bot/dist/src/bot/commands/utility/Ping.js",
                "lineno": 18,
                "colno": 15,
                "pre_context": [
                  "                content: 'Provides the ping for ALPH4',",
                  "                usage: null,",
                  "                examples: null",
                  "            }",
                  "        });",
                  "    }",
                  "    async exec(message) {"
                ],
                "context_line": "        throw new Error('Why are you not working?');",
                "post_context": [
                  "        const msg = await message.util.send('Ping?');",
                  "        return message.util.edit([",
                  "            `${EmojiUtils_1.DISCORD_EMOJIS.BELL} Ping:`,",
                  "            '',",
                  "            `• API Ping - \\`${message.client.ws.ping}ms\\``,",
                  "            `• Gateway Ping - \\`${msg.createdTimestamp - message.createdTimestamp}ms\\``",
                  "        ]);"
                ],
                "in_app": true
              }
            ]
          },
          "mechanism": {
            "type": "generic",
            "handled": true
          }
        }
      ]
    },
    "tags": [
      [
        "environment",
        "development"
      ],
      [
        "handled",
        "yes"
      ],
      [
        "level",
        "error"
      ],
      [
        "mechanism",
        "generic"
      ]
    ],
    "sdk": {
      "name": "sentry.javascript.node",
      "version": "6.6.0",
      "integrations": [
        "InboundFilters",
        "FunctionToString",
        "Console",
        "Http",
        "OnUncaughtException",
        "OnUnhandledRejection",
        "LinkedErrors",
        "Mongo"
      ],
      "packages": [
        {
          "name": "npm:@sentry/node",
          "version": "6.6.0"
        }
      ]
    },
    "key_id": "1665297",
    "project": 5812192,
    "grouping_config": {
      "enhancements": "eJybzDRxY3J-bm5-npWRgaGlroGxrpHxBABcYgcZ",
      "id": "newstyle:2019-10-29"
    },
    "_metrics": {
      "bytes.ingested.event": 9499,
      "bytes.stored.event": 12736
    },
    "_ref": 5812192,
    "_ref_version": 2,
    "hashes": [
      "8ceaf41553f44dca358ac0995e9e2ff7",
      "97cd371209b2d32e675e79b133275e6a"
    ],
    "location": "/home/xenfo/Desktop/Projects/alph4/alph4-bot/dist/src/bot/commands/utility/Ping.js",
    "metadata": {
      "filename": "/home/xenfo/Desktop/Projects/alph4/alph4-bot/dist/src/bot/commands/utility/Ping.js",
      "function": "PingCommand.exec",
      "type": "Error",
      "value": "Why are you not working?"
    },
    "title": "Error: Why are you not working?",
    "id": "39e983d6a39b451da0f2c1c7cef8c5a6"
  }
}
IanMitchell commented 3 years ago

🙏 that stack trace is super helpful - going to deploy a potential fix in a minute here

IanMitchell commented 3 years ago

I may not have fixed everything with this - if you're still able to repro let me know 🙏

samchouse commented 3 years ago

Looks good, only thing is that contexts are undefined. That might just be my context types though.