Skip to content

Team Notes longer than 1024 characters don't get added to Discord #112

Description

@robere2

Describe the bug
Discord Embed fields have a max text limit of 1024 characters, but our database schema allows Production team notes to be of any length. If you create notes longer than 1024 characters for a Production that is displayed in Discord, it causes an error on the Discord bot, e.g.:

discord-1  | At 01/08/2025 19:06:52 Unhandled promise rejection: CombinedPropertyError (1)
discord-1  |   Received one or more errors
discord-1  |
discord-1  |   input[6]
discord-1  |   | CombinedPropertyError (1)
discord-1  |   |   Received one or more errors
discord-1  |   |
discord-1  |   |   input.value
discord-1  |   |   | ExpectedConstraintError > s.string().lengthLessThanOrEqual()
discord-1  |   |   |   Invalid string length
discord-1  |   |   |
discord-1  |   |   |   Expected: expected.length <= 1024
discord-1  |   |   |
discord-1  |   |   |   Received:
discord-1  |   |   |   | '<REDACTED>'
discord-1  |
discord-1  |     at _ArrayValidator.handle (/usr/src/app/apps/discord/node_modules/@sapphire/shapeshift/src/validators/ArrayValidator.ts:21:90)
discord-1  |     at _ArrayValidator.parse (/usr/src/app/apps/discord/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:126:2)
discord-1  |     at EmbedBuilder.addFields (/usr/src/app/apps/discord/node_modules/@discordjs/builders/src/messages/embed/Embed.ts:116:29)
discord-1  |     at createUnvolunteerEmbed (/usr/src/app/apps/discord/src/util.ts:165:6)
discord-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
discord-1  |     at async Object.execute (/usr/src/app/apps/discord/src/events/api/updateProduction.ts:67:32)
discord-1  |

To Reproduce

  1. Create a Production
  2. Edit the team notes to be a string longer than 1024 characters
  3. The Embed will not change

Alternatively:

  1. Create a Production with team notes longer than 1024 characters
  2. The Embed will not be created

Expected behavior
Messages and channels should be created regardless of the length of the team notes

Possible solutions:

  • Limit team notes to 1024 characters in the DB
  • Link to the website when team notes are longer than 1024 characters (would have implications on permissions)
  • Truncate team notes whenever they are longer than 1024 characters

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Complexity: LOWThis issue is trivial and is expected to take less than an hour to complete.Module: APIThis issue pertains to the apps/api moduleModule: DiscordThis issue pertains to the apps/discord moduleModule: PrismaThis issue pertains to the packages/prisma modulePriority: HIGHThis issue is halting multiple issues, significantly hindering users, or is a minor security issue.Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions