2026-01-05: Fix DeleteMeal Resolver Typos
Task Metadata
Date: 2026-01-05
Status: Completed
1. Context
- Goal: Fix a
DynamoDB:DynamoDbExceptionoccurring during meal deletion. - Trigger: User reported
Invalid UpdateExpression: An expression attribute value used in expression is not defined; attribute value: :fat.
2. Approach
- Technical Strategy:
- Inspect
appsync/deleteMeal_step2.js. - Identify mismatch between
UpdateExpressionplaceholders andExpressionAttributeValues. - Correct the typos in the expression string.
- Inspect
- Key Decisions:
- The expression uses
:fatand:carbbut the values map defines:negFatand:negCarb. - Will update the expression to use
:negFatand:negCarbto match the intent (decrementing values).
- The expression uses
3. Impact Analysis
- Files to Modify:
appsync/deleteMeal_step2.js
- Risks:
- None. This fixes a broken resolver.
4. Execution Plan
- Fix typos in
appsync/deleteMeal_step2.js. - Update
docs/project_management/index.md(optional, for tracking).
5. Execution Notes
- The bug was a simple variable name mismatch in the AppSync JavaScript resolver.
- Added unit test
appsync/__tests__/deleteMeal.test.jsto verify the generated DynamoDB expression matches the attribute values, ensuring regression prevention. - Legacy Attribute Support: Updated
deleteMealresolver to map PascalCase attributes (e.g.,SK,MealSummary) from legacy items to camelCase (sk,mealSummary) to preventCannot return null for non-nullable typeGraphQL errors. Verified with new test cases.