sms: more debugging info

This commit is contained in:
2026-09-06 09:32:03 -06:00
parent bfac283690
commit 2e34bed700
2 changed files with 12 additions and 2 deletions
+7
View File
@@ -309,6 +309,13 @@ number such as `+15555550123` is rejected with `21211`. Both scripts refuse to
run with that placeholder once Twilio is configured, rather than spending a
round trip to learn it.
The destination is normalized before anything is sent, and both scripts echo
the result — check that line first when Twilio rejects a number. Ten digits with
no `+` are assumed US, so `8015601471`, `801-560-1471` and `+18015601471` all
reach the same place. A `+` prefix is taken at its word: `+8015601471` is
syntactically valid E.164 with country code `80`, so it passes normalization and
is rejected by Twilio rather than here.
A **real** `To` under test credentials is less predictable: some accounts accept
it and return a synthetic SID, others answer `20404`
(`resource ... Messages.json was not found`) despite the credentials being
+5 -2
View File
@@ -93,6 +93,7 @@ async function main(): Promise<void> {
? `Twilio credentials present: real API call, From=${smsConfig().twilioFromNumber ?? smsConfig().twilioMessagingServiceSid}`
: "No Twilio credentials: console adapter, nothing leaves the machine"
);
console.log("To:", TO_NUMBER);
console.log("Data dir:", process.env.NOTIFY_DATA_DIR, "\n");
const app = express();
@@ -153,8 +154,10 @@ async function main(): Promise<void> {
console.error(
"\nNo devCode in the response, so the code never went out. The " +
"code-send-failed detail above is Twilio's own words.\n" +
" \u2022 'To' rejected: use a real number Twilio can validate, not a " +
"fictional 555-01xx one.\n" +
` \u2022 'To' rejected (${TO_NUMBER}): check the country code — a US ` +
"number is +1 and ten digits (+18015601471, not +8015601471). Passing " +
"the ten digits with no + at all assumes US. Fictional 555-01xx numbers " +
"are rejected too.\n" +
" \u2022 'From' rejected (21606): under test credentials it must be " +
"+15005550006; under live credentials it must be a number you own, or " +
"a Messaging Service SID.\n" +