Conversation
What was broken Closed ticket owners received a 500 response when replying because the reopen transaction depended on a database enum migration that deployments could leave unapplied. Root cause The production container started the API directly and relied on a manual one-off Prisma migration. The deployed reopen path writes TICKET_REOPENED notification rows, so schema drift caused PostgreSQL to reject the transaction. What was changed The production startup now runs prisma migrate deploy before launching the API and stops if migration fails. Deployment documentation now describes the automatic startup migration behavior. Any added/updated tests Added startup regression coverage that verifies the production image uses the startup script, migrations run before Node, and the API does not start after a migration failure. All 51 tests, lint, build, shell syntax, and Dockerfile checks pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was broken
Closed ticket owners received a 500 Internal Server Error when submitting a reply, while replies to open tickets continued to work.
Root cause
The deployed reopen path writes notification outbox rows with the
TICKET_REOPENEDPostgreSQL enum value. That value is introduced by a Prisma migration, but the production container started the API directly and depended on a manual one-off migration. When application code was deployed ahead of the database migration, PostgreSQL rejected the reopen transaction and Nest returned a generic 500.What was changed
prisma migrate deploybefore starting the API.Any added/updated tests
pnpm lint,pnpm build,sh -n appStartUp.sh,git diff --check, anddocker build --check .successfully.A full Docker image build was also attempted twice, but both attempts stopped in the pre-existing Alpine package-install layer because
dl-cdn.alpinelinux.orgreturned transient DNS errors. No changed Docker layer failed.