Commit 2c9b5ac
fix(discord): split Function URL permissions and trim credentials (#41)
## Summary
- **`terraform/interactions.tf`**: The single `aws_lambda_permission`
with `action = lambda:InvokeFunction` + `function_url_auth_type = NONE`
was rejected by AWS with `InvalidParameterValueException` — AWS only
accepts `function_url_auth_type` paired with `lambda:InvokeFunctionUrl`.
Split into two statements: one for `lambda:InvokeFunctionUrl` (with
`function_url_auth_type = NONE`) and one for `lambda:InvokeFunction`
(without it). Both permissions are required since October 2025 for
Discord's endpoint validation to pass.
- **`app/packages/shared/src/secrets/secretsStore.ts`**: Added `.trim()`
to all four credential accessors (`getBotToken`, `getPublicKey`,
`putBotToken`, `putPublicKey`) to strip surrounding whitespace from
pasted Discord credentials — a common copy-paste artifact that causes
401s from the Discord API.
- **`.gitignore`**: Added `.claude/worktrees/` and
`app/packages/server/src/generated/tfstate.ts` (auto-generated; should
never be committed with real state).
## Test plan
- [ ] `terraform plan` shows two `aws_lambda_permission` resources, no
destructive changes
- [ ] `terraform apply` completes without
`InvalidParameterValueException`
- [ ] Discord endpoint validation succeeds after apply (re-enter URL in
Developer Portal if needed)
- [ ] Pasting a bot token or public key with leading/trailing whitespace
via the UI saves and reads back trimmed
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent ff71f60 commit 2c9b5ac
4 files changed
Lines changed: 34 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | | - | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | | - | |
| 70 | + | |
69 | 71 | | |
70 | | - | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | | - | |
| 75 | + | |
74 | 76 | | |
75 | | - | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
113 | 116 | | |
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
118 | 128 | | |
119 | 129 | | |
120 | 130 | | |
| |||
0 commit comments