fix(deploy): include coin module in ModulesCSV overrides

coin was registered in the catalog and template default but absent from
the ModulesCSV override in both deploy.yml and samconfig.toml, so the
deployed Lambda never loaded it and all coin_* commands went unregistered.

Add a registration checklist to docs/deploy-aws.md to prevent recurrence.
This commit is contained in:
tiennm99 committed 2026-06-12 11:22:16 +07:00
1 parent 49a6e7091a
commit 62555dee23
3 files changed
+28 -2

No files matched your search

+1 -1
View File
@@ -60,7 +60,7 @@ jobs:
# Telegram user IDs are public (visible to anyone the bot DMs), so
# they live in this committed workflow rather than a secret.
# Keep this module list in sync with samconfig.toml's ModulesCSV.
OVERRIDES="CronSharedSecret=$CRON_SECRET BotOwnerID=1064111334 AdminUserIDs=1064111334 ModulesCSV=util,misc,wordle,loldle,lolschedule,twentyq,trading,stats,gold"
OVERRIDES="CronSharedSecret=$CRON_SECRET BotOwnerID=1064111334 AdminUserIDs=1064111334 ModulesCSV=util,misc,wordle,loldle,lolschedule,twentyq,trading,stats,gold,coin"
if [ -n "$ALERT_EMAIL" ]; then
OVERRIDES="$OVERRIDES AlertEmail=$ALERT_EMAIL"
fi
+26
View File
@@ -76,6 +76,32 @@ curl "https://api.telegram.org/bot$TOKEN/getWebhookInfo" | jq .
```
Expect: `url` matches Function URL, `pending_update_count` ≈ 0, `last_error_date` empty.
## Adding a module or command (registration checklist)
A module only runs in production if its name is in **both** `ModulesCSV` sources — the
`template.yaml` default is ignored once an override is passed, so editing one place is
not enough. A command only appears in the Telegram menu if it is in
`aws/telegram-commands.json`. Missing either is silent: no error, the command just
never dispatches (this is how `coin_*` shipped dark until `coin` was added to the CSVs).
When **adding a new module**, register it in all of:
1. `cmd/server/main.go` — add the factory to the catalog (`"name": pkg.New`).
2. `.github/workflows/deploy.yml` — append the name to `ModulesCSV=…` (CI override).
3. `samconfig.toml` — append the name to `ModulesCSV=…` (manual-deploy override; keep in sync with the workflow).
4. `template.yaml` — append to the `ModulesCSV` `Default` (documents the full set).
5. `aws/telegram-commands.json` — add each new command + description for the Telegram menu.
When **adding a command to an existing, already-enabled module**, only step 5 applies.
**On push to `main`:** CI redeploys and re-runs `setMyCommands` from
`aws/telegram-commands.json` automatically. The Telegram client caches the command
menu, so a changed menu may not show until the chat is reopened — confirm with
`make telegram-commands-info` (calls `getMyCommands`) rather than trusting the app UI.
Only when a push introduces **new public commands** (`VisibilityPublic`) does the menu
need attention — re-confirm registration for those pushes; routine pushes (refactors,
fixes, non-public commands) need no menu action.
## Trading income events API
`/trade_income_events` uses a FireAnt REST API, configured at Lambda runtime:
+1 -1
View File
@@ -13,7 +13,7 @@ resolve_s3 = true
s3_prefix = "miti99bot"
# Secrets MUST live in SSM Parameter Store (see aws/README.md). Never put
# them here — this file is committed.
parameter_overrides = "StackEnv=\"prod\" ModulesCSV=\"util,misc,wordle,loldle,lolschedule,twentyq,trading,stats,gold\" BotOwnerID=\"1064111334\" AdminUserIDs=\"1064111334\" LambdaAdapterLayerArn=\"arn:aws:lambda:ap-southeast-1:753240598075:layer:LambdaAdapterLayerArm64:25\" AlertEmail=\"minhtienit99@gmail.com\""
parameter_overrides = "StackEnv=\"prod\" ModulesCSV=\"util,misc,wordle,loldle,lolschedule,twentyq,trading,stats,gold,coin\" BotOwnerID=\"1064111334\" AdminUserIDs=\"1064111334\" LambdaAdapterLayerArn=\"arn:aws:lambda:ap-southeast-1:753240598075:layer:LambdaAdapterLayerArm64:25\" AlertEmail=\"minhtienit99@gmail.com\""
image_repositories = []
[default.validate.parameters]