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

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

Open
robere2 opened this issue Jan 8, 2025 · 0 comments
Open

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

robere2 opened this issue Jan 8, 2025 · 0 comments
Labels
Complexity: LOW This issue is trivial and is expected to take less than an hour to complete. Module: API This issue pertains to the apps/api module Module: Discord This issue pertains to the apps/discord module Module: Prisma This issue pertains to the packages/prisma module Priority: HIGH This issue is halting multiple issues, significantly hindering users, or is a minor security issue. Type: Bug Something isn't working

Comments

@robere2
Copy link
Member

robere2 commented Jan 8, 2025

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
@robere2 robere2 added Priority: HIGH This issue is halting multiple issues, significantly hindering users, or is a minor security issue. Type: Bug Something isn't working Module: API This issue pertains to the apps/api module Module: Prisma This issue pertains to the packages/prisma module Module: Discord This issue pertains to the apps/discord module Complexity: LOW This issue is trivial and is expected to take less than an hour to complete. labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: LOW This issue is trivial and is expected to take less than an hour to complete. Module: API This issue pertains to the apps/api module Module: Discord This issue pertains to the apps/discord module Module: Prisma This issue pertains to the packages/prisma module Priority: HIGH This issue is halting multiple issues, significantly hindering users, or is a minor security issue. Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant