Common errors
From the API
| Symptom | Likely cause | What to do |
|---|---|---|
404 on a route that exists in Go | The path is missing from authedRoutes in api-stack.ts, so API Gateway answers before the Lambda runs. | Add the route there and update the route count in infra/test/api-stack.test.ts. |
401 for a signed-in caregiver | The token expired, or the account is closed. | Check the caller's user row in caregiver-{stage}-v1-user (status). |
| Invitations don't match, or a new caregiver has no email | The app sent the Cognito access token instead of the ID token. API Gateway accepts either, but only the ID token carries email and name. | Check the app's AuthMiddleware sends idToken(). |
403 | The caller is not on the record's care team, or the action needs the team's admin. | Expected behavior. Check the caller's memberships in caregiver-{stage}-v1-membership. |
404 for a record that exists | The record is archived, or its care team is closed. | Expected behavior; see the API overview. |
500 with a short message | A handler hit an error. | Find the "server error" line for that request_id in Logs; err has the cause. |
Every request fails after a deploy, with must be set in the logs | A new environment variable is read in Go but not set in CDK. The Lambda exits at startup. | Add it to the function's environment in api-stack.ts and redeploy, or revert. |
429 on Send feedback | That route allows 1 request a second, bursts of 5. | Expected behavior. |
| A flag change doesn't take effect | AppConfig answers are cached for about 45 seconds. | Wait a minute. |
From the generator
| Symptom | Likely cause | What to do |
|---|---|---|
| A new schedule shows no upcoming entries | Writing entries after the save failed ("schedule generation failed"). | The daily run fills them in, or run the generator by hand (see Alarms). |
| Coming up is empty for everyone | The generator hasn't run for over two weeks. | Check its log group for recent "run complete" lines and the EventBridge rule. |
From CI and deploys
| Symptom | Likely cause | What to do |
|---|---|---|
lint fails on Prettier | Unformatted files. | pnpm exec prettier --write <files> and commit. |
| Commit rejected by commitlint | The message isn't a Conventional Commit, or its subject starts with a capital letter. | Reword, for example fix(api): …. |
| Codegen drift check fails | The contract changed but the generated files weren't regenerated. | cd shared/types-go && make codegen, then commit. The pre-commit hook normally does this. |
docs job fails | A broken link in the docs, a page linking to a file that moved, or private data on a page. | Run pnpm --filter @caregiver/docs build and python3 scripts/check-docs.py locally. |
| A deploy fails with "export … cannot be deleted" | One stack still imports a value another stack is trying to remove. | Deploy in two steps: stop using it, then remove it (Infrastructure). |
cdk diff on the PR shows surprise changes | Someone changed AWS by hand, or CDK context drifted. | Read the diff before merging. Merging applies it to prod. |