Skip to content

fix(shop): PAYMENT_PROVIDER_NOT_CONFIGURED names the credential that's wrong (#216) - #226

Merged
thunpisit merged 3 commits into
mainfrom
fix/payment-config-diagnostics
Oct 25, 2026
Merged

thunpisit merged 3 commits into
mainfrom
fix/payment-config-diagnostics

Conversation

@thunpisit

Copy link
Copy Markdown
Contributor

Closes #216.

Before

Payment provider beam is not configured … Set BEAM_MERCHANT_ID + BEAM_API_KEY + BEAM_WEBHOOK_SECRET in wrangler.toml [vars] and redeploy.: the same text whether a key was never set, saved but undecryptable after a BETTER_AUTH_SECRET rotation, or set under the wrong name. bactrack had the last two at once.

After

  • diagnoseSecrets() (secrets service): per key env | stored | undecryptable | missing.
  • unreadLookalikes(): set env vars with the provider's prefix that Khao Pad doesn't read, e.g. BEAM_SECRET_KEY.
  • The 503 names what's not set, what can't be decrypted (with the rotation hint), which lookalikes are ignored, and points to /admin/settings/secrets (no redeploy). It also returns missing / undecryptable arrays and logs the line server-side. Key names only, never values (pinned by a test).
  • The admin secrets page already flags undecryptable rows; unchanged.

Live on a local worker configured like bactrack was:

Payment provider 'beam' is not configured for method 'promptpay'. Not set: BEAM_API_KEY. Set but not read by Khao Pad (check the name): BEAM_SECRET_KEY. Enter credentials at /admin/settings/secrets (takes effect immediately), or set them as Worker secrets.

Tests

3 integration tests (env/stored/undecryptable/missing; the exact bactrack case incl. no values leaked; only-missing listed).
Gate: lint 0 errors · check 0 · 1170/1170 · build · contract-guard.

🤖 Generated with Claude Code

thunpisit and others added 3 commits October 25, 2026 19:33
…s wrong (#216)

The 503 listed all three Beam keys and told the merchant to edit
wrangler.toml and redeploy, whatever was actually wrong. On bactrack
the cause was a stored BEAM_API_KEY that no longer decrypted (and a
legacy BEAM_SECRET_KEY the code never reads) — indistinguishable from
"never set", because getSecrets returns null for both.

- secrets/service: diagnoseSecrets() → env | stored | undecryptable |
  missing per key; unreadLookalikes() finds set env vars with the same
  prefix that Khao Pad doesn't read (BEAM_SECRET_KEY).
- The 503 now says which keys are not set, which are saved but can't
  be decrypted (with the BETTER_AUTH_SECRET hint), which lookalikes are
  ignored, and points at /admin/settings/secrets instead of a redeploy.
  It also returns `missing` / `undecryptable` arrays and logs the same
  line. Key names only, never values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They are read (API host overrides). Caught by the admin payment-health
card on a local worker pointed at a fake Beam.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thunpisit
thunpisit merged commit 3d9b608 into main Oct 25, 2026
2 checks passed
@thunpisit thunpisit mentioned this pull request Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PAYMENT_PROVIDER_NOT_CONFIGURED gives no way to tell which credential is missing or undecryptable

1 participant