fix: moderation payload crash and test/verify 500 - #48
Merged
Merged
Conversation
Fastify 500s when the web client sends Content-Type application/json with no body (DevUnlock's POST /auth/test/verify). Only set that header when there is a body. Legacy pending contribs have no payload at all; rendering item.payload.name crashes the queue. Drop those rows from listPending (newest first) and guard the UI.
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.
Summary
POST /api/auth/test/verify500s on dev: FastifyBody cannot be empty when content-type is set to application/json. The webrequest()helper always sent that header, including DevUnlock's empty POST. Only setContent-Typewhen there is a body.TypeError: … payload.name: GSI2STATUS#pendingincludes legacy contrib rows with nopayloadattribute. The queue rendereditem.payload.nameand crashed.listPendingnow drops those rows and queries newest-first so recent scraper candidates are not buried; the UI also optional-chains.Test plan
pnpm --filter @btfp/bff test(includes newlistPendingfilter spec)dev.badthingsforpets.com/moderationwhile signed in but unverified: DevUnlock should not 500payload.namecrash