Skip to content
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

Discord sending embeds with no name, causing lib exception #3892

Closed
MattIPv4 opened this issue Mar 3, 2020 · 3 comments · Fixed by #3894
Closed

Discord sending embeds with no name, causing lib exception #3892

MattIPv4 opened this issue Mar 3, 2020 · 3 comments · Fixed by #3894

Comments

@MattIPv4
Copy link
Contributor

MattIPv4 commented Mar 3, 2020

Please describe the problem you are having in as much detail as possible:

Running a bot that is not sending any embeds every. Seeing RangeError [EMBED_FIELD_NAME]: MessageEmbed field names may not be empty. being thrown by the library, completely internally based on the error stack. This is causing the bot to completely crash.

Include a reproducible code sample here, if possible:

Code doesn't really seem important here, would happen with any bot I assume.

Stack trace:

[BOT PATH]\node_modules\discord.js\src\structures\MessageEmbed.js:413
    if (!name) throw new RangeError('EMBED_FIELD_NAME');
               ^

RangeError [EMBED_FIELD_NAME]: MessageEmbed field names may not be empty.
    at Function.normalizeField ([BOT PATH]\node_modules\discord.js\src\structures\MessageEmbed.js:413:22)
    at [BOT PATH]\node_modules\discord.js\src\structures\MessageEmbed.js:435:14
    at Array.map (<anonymous>)
    at Function.normalizeFields ([BOT PATH]\node_modules\discord.js\src\structures\MessageEmbed.js:434:8)
    at MessageEmbed.setup ([BOT PATH]\node_modules\discord.js\src\structures\MessageEmbed.js:68:50)
    at new MessageEmbed ([BOT PATH]\node_modules\discord.js\src\structures\MessageEmbed.js:11:10)
    at [BOT PATH]\node_modules\discord.js\src\structures\Message.js:101:48
    at Array.map (<anonymous>)
    at Message._patch ([BOT PATH]\node_modules\discord.js\src\structures\Message.js:101:39)
    at new Message ([BOT PATH]\node_modules\discord.js\src\structures\Message.js:43:20)
    at MessageManager.add ([BOT PATH]\node_modules\discord.js\src\managers\BaseManager.js:49:32)
    at MessageManager.add ([BOT PATH]\node_modules\discord.js\src\managers\MessageManager.js:29:18)
    at MessageCreateAction.handle ([BOT PATH]\node_modules\discord.js\src\client\actions\MessageCreate.js:13:40)
    at Object.module.exports [as MESSAGE_CREATE] ([BOT PATH]\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket ([BOT PATH]\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket ([BOT PATH]\node_modules\discord.js\src\client\websocket\WebSocketShard.js:435:22) {
  [Symbol(code)]: 'EMBED_FIELD_NAME'
}

Further details:

  • discord.js version: 12.0.1
  • Node.js version: 12.15.0
  • Operating system: Windows server 2016
  • Priority this issue should have – please be realistic and elaborate if possible: P0 - Crashing internally.
@MattIPv4
Copy link
Contributor Author

MattIPv4 commented Mar 4, 2020

I dumped the raw data for one of the embeds causing this:

{"url":"https://www.deadstock.ca/products/rototo-loose-pile-socks-yellow","type":"rich","title":"RoToTo Loose Pile Socks / Yellow","thumbnail":{"width":1000,"url":"https://cdn.shopify.com/s/files/1/0616/3517/products/r10141023f19_rototo_loose_pile_socks_yellow_1.jpg","proxy_url":"https://images-ext-2.discordapp.net/external/zOsGJX7X5YPh6kpnA9aaeFToOl4nJlBW41-DzKqanmo/https/cdn.shopify.com/s/files/1/0616/3517/products/r10141023f19_rototo_loose_pile_socks_yellow_1.jpg","height":1000},"footer":{"text":"Shopify v9.0.3 | @AK  by ZephyrMonitors [06:42:46]","proxy_icon_url":"https://media.discordapp.net/attachments/577593441886928897/640982567721631784/AK.png","icon_url":"https://cdn.discordapp.com/attachments/577593441886928897/640982567721631784/AK.png"},"fields":[{"value":"26.00 CAD (19.46 USD)","name":"Price","inline":true},{"value":"1+","name":"Stock","inline":true},{"value":"","name":"","inline":false},{"value":"[MED](https://www.deadstock.ca/cart/31777347829845:1) | [QT](http://snkrsol.com/q?l=www.deadstock.ca/cart/31777347829845) [1+]","name":"ATC","inline":true},{"value":"","name":"ATC","inline":true},{"value":"","name":"","inline":false},{"value":"[ Product Quicktask](http://snkrsol.com/m?l=www.deadstock.ca/products/rototo-loose-pile-socks-yellow ) | [ Link Change](http://snkrsol.com/c?l=www.deadstock.ca/products/rototo-loose-pile-socks-yellow ) | [StockX](https://stockx.com/search?s=RoToTo%20Loose%20Pile%20Socks%20/%20Yellow) | [ Setup](http://quicktasks.snkrsol.com/manager ) | [ Feedback](https://www.zephyrmonitors.com/feedback )","name":"Links","inline":false}],"color":16777215,"author":{"url":"https://www.deadstock.ca/","name":"https://www.deadstock.ca/"}}

@papaia
Copy link
Contributor

papaia commented Mar 4, 2020

Just inspected the embed for readability:

{
  url: 'https://www.deadstock.ca/products/rototo-loose-pile-socks-yellow',
  type: 'rich',
  title: 'RoToTo Loose Pile Socks / Yellow',
  thumbnail: {
    width: 1000,
    url: 'https://cdn.shopify.com/s/files/1/0616/3517/products/r10141023f19_rototo_loose_pile_socks_yellow_1.jpg',
    proxy_url: 'https://images-ext-2.discordapp.net/external/zOsGJX7X5YPh6kpnA9aaeFToOl4nJlBW41-DzKqanmo/https/cdn.shopify.com/s/files/1/0616/3517/products/r10141023f19_rototo_loose_pile_socks_yellow_1.jpg',
    height: 1000
  },
  footer: {
    text: 'Shopify v9.0.3 | @AK  by ZephyrMonitors [06:42:46]',
    proxy_icon_url: 'https://media.discordapp.net/attachments/577593441886928897/640982567721631784/AK.png',
    icon_url: 'https://cdn.discordapp.com/attachments/577593441886928897/640982567721631784/AK.png'
  },
  fields: [
    { value: '26.00 CAD (19.46 USD)', name: 'Price', inline: true },
    { value: '1+', name: 'Stock', inline: true },
    { value: '', name: '', inline: false },
    {
      value: '[MED](https://www.deadstock.ca/cart/31777347829845:1) | [QT](http://snkrsol.com/q?l=www.deadstock.ca/cart/31777347829845) [1+]',
      name: 'ATC',
      inline: true
    },
    { value: '', name: 'ATC', inline: true },
    { value: '', name: '', inline: false },
    {
      value: '[ Product Quicktask](http://snkrsol.com/m?l=www.deadstock.ca/products/rototo-loose-pile-socks-yellow ) | [ Link Change](http://snkrsol.com/c?l=www.deadstock.ca/products/rototo-loose-pile-socks-yellow ) | [StockX](https://stockx.com/search?s=RoToTo%20Loose%20Pile%20Socks%20/%20Yellow) | [ Setup](http://quicktasks.snkrsol.com/manager ) | [ Feedback](https://www.zephyrmonitors.com/feedback )',
      name: 'Links',
      inline: false
    }
  ],
  color: 16777215,
  author: {
    url: 'https://www.deadstock.ca/',
    name: 'https://www.deadstock.ca/'
  }
}

@mtgsquad

This comment has been minimized.

@discordjs discordjs locked as resolved and limited conversation to collaborators Jun 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants