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
- Create a Production
- Edit the team notes to be a string longer than 1024 characters
- The Embed will not change
Alternatively:
- Create a Production with team notes longer than 1024 characters
- 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
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.:
To Reproduce
Alternatively:
Expected behavior
Messages and channels should be created regardless of the length of the team notes
Possible solutions: