Skip to content

2026-01-05: Fix DeleteMeal Resolver Typos

Task Metadata

  • 📆 Date: 2026-01-05
  • 🚥 Status: Completed

1. Context

  • Goal: Fix a DynamoDB:DynamoDbException occurring 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 UpdateExpression placeholders and ExpressionAttributeValues.
    • Correct the typos in the expression string.
  • Key Decisions:
    • The expression uses :fat and :carb but the values map defines :negFat and :negCarb.
    • Will update the expression to use :negFat and :negCarb to match the intent (decrementing values).

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.js to verify the generated DynamoDB expression matches the attribute values, ensuring regression prevention.
  • Legacy Attribute Support: Updated deleteMeal resolver to map PascalCase attributes (e.g., SK, MealSummary) from legacy items to camelCase (sk, mealSummary) to prevent Cannot return null for non-nullable type GraphQL errors. Verified with new test cases.