starryzone/starrybot-discord

Investigate error

mikedotexe opened this issue · 0 comments

I saw this in the logs:

Oct 16 09:36:49 AM  Comparing 3 against 10
Oct 16 09:41:14 AM  node:events:505
Oct 16 09:41:14 AM        throw er; // Unhandled 'error' event
Oct 16 09:41:14 AM        ^
Oct 16 09:41:14 AM  
Oct 16 09:41:14 AM  DiscordAPIError[50035]: Invalid Form Body
Oct 16 09:41:14 AM  name[BASE_TYPE_REQUIRED]: This field is required
Oct 16 09:41:14 AM      at SequentialHandler.runRequest (/opt/render/project/src/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:743:15)
Oct 16 09:41:14 AM      at processTicksAndRejections (node:internal/process/task_queues:96:5)
Oct 16 09:41:14 AM      at async SequentialHandler.queueRequest (/opt/render/project/src/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:549:14)
Oct 16 09:41:14 AM      at async REST.request (/opt/render/project/src/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:988:22)
Oct 16 09:41:14 AM      at async GuildChannelManager.create (/opt/render/project/src/node_modules/discord.js/src/managers/GuildChannelManager.js:149:18)
Oct 16 09:41:14 AM      at async Client.guildCreate (/opt/render/project/src/src/handlers/guildCreate.js:42:27)
Oct 16 09:41:14 AM  Emitted 'error' event on Client instance at:
Oct 16 09:41:14 AM      at emitUnhandledRejectionOrErr (node:events:384:10)
Oct 16 09:41:14 AM      at processTicksAndRejections (node:internal/process/task_queues:85:21) {
Oct 16 09:41:14 AM    requestBody: {
Oct 16 09:41:14 AM      files: undefined,
Oct 16 09:41:14 AM      json: {
Oct 16 09:41:14 AM        name: undefined,
Oct 16 09:41:14 AM        topic: undefined,
Oct 16 09:41:14 AM        type: undefined,
Oct 16 09:41:14 AM        nsfw: undefined,
Oct 16 09:41:14 AM        bitrate: undefined,
Oct 16 09:41:14 AM        user_limit: undefined,
Oct 16 09:41:14 AM        parent_id: undefined,
Oct 16 09:41:14 AM        position: undefined,
Oct 16 09:41:14 AM        permission_overwrites: undefined,
Oct 16 09:41:14 AM        rate_limit_per_user: undefined,
Oct 16 09:41:14 AM        rtc_region: undefined,
Oct 16 09:41:14 AM        video_quality_mode: undefined,
Oct 16 09:41:14 AM        available_tags: undefined,
Oct 16 09:41:14 AM        default_reaction_emoji: undefined
Oct 16 09:41:14 AM      }
Oct 16 09:41:14 AM    },
Oct 16 09:41:14 AM    rawError: {
Oct 16 09:41:14 AM      code: 50035,
Oct 16 09:41:14 AM      errors: {
Oct 16 09:41:14 AM        name: {
Oct 16 09:41:14 AM          _errors: [
Oct 16 09:41:14 AM            {
Oct 16 09:41:14 AM              code: 'BASE_TYPE_REQUIRED',
Oct 16 09:41:14 AM              message: 'This field is required'
Oct 16 09:41:14 AM            }
Oct 16 09:41:14 AM          ]
Oct 16 09:41:14 AM        }
Oct 16 09:41:14 AM      },
Oct 16 09:41:14 AM      message: 'Invalid Form Body'
Oct 16 09:41:14 AM    },
Oct 16 09:41:14 AM    code: 50035,
Oct 16 09:41:14 AM    status: 400,
Oct 16 09:41:14 AM    method: 'POST',
Oct 16 09:41:14 AM    url: 'https://discord.com/api/v10/guilds/950805706142015538/channels'
Oct 16 09:41:14 AM  }

So it looks like the "name" field is required.

const creationRes = await guild.channels.create('starrybot')

I don't think we even need to create a channel, do we? Feels like we can remove this.