Skip to content

Fix express-checkout env mismatch and drop a nonexistent CSP host - #28

Open
east-6 wants to merge 1 commit into
mainfrom
fix-express-checkout-env-and-csp
Open

Fix express-checkout env mismatch and drop a nonexistent CSP host#28
east-6 wants to merge 1 commit into
mainfrom
fix-express-checkout-env-and-csp

Conversation

@east-6

@east-6 east-6 commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Two small fixes to express-checkout, both of which a reader following the published article can hit.

1. WHOP_COMPANY_ID was required but never used

lib/env.ts had it in the runtime schema, so getEnv() threw without it. Nothing in the app reads it. The only consumer is scripts/setup.mjs, which reads process.env.WHOP_COMPANY_ID directly and already prints its own message if it is missing.

The published article does not list WHOP_COMPANY_ID in its env var table, so anyone who followed the article and then cloned this project hit a startup error for a variable the app never needed.

Removed from the runtime schema. .env.example keeps it, now labelled as only needed by npm run setup.

Verified: next build succeeds with only the four variables the article lists (WHOP_COMPANY_API_KEY, WHOP_SANDBOX, SESSION_SECRET, APP_URL).

2. sandbox-js.whop.com does not exist

It was in script-src. DNS returns NXDOMAIN for it, and grepping the shipped @whop/checkout package finds zero references in either 0.3.1 or 0.0.54. The only Whop hosts in that bundle are sandbox.whop.com, whop.com and t.whop.tw.

The sandbox checkout is framed from sandbox.whop.com, which frame-src https://*.whop.com already covers. Allowlisting a host that does not resolve is a no-op at runtime, but it is wrong and it gets copied.

js.whop.com, t.whop.tw and cdn.plaid.com are untouched.

Note for a follow-up

The same phantom host appears in 10 other files across 6 projects: embedded-chat, free-trial, linktree-clone, medium-clone and paywall, plus two docs/ files and a vercel.ts. Left alone here to keep this PR scoped. Happy to do a sweep separately.

Two fixes, both reader-facing.

lib/env.ts required WHOP_COMPANY_ID, but nothing at runtime reads it. Only
scripts/setup.mjs uses it, and that reads process.env directly with its own
error message. The published article does not list it in its env table, so a
reader who followed the article and cloned this project hit a startup throw
on an env var the app never needed. It is now out of the runtime schema and
noted in .env.example as setup-only.

next.config.ts allowed https://sandbox-js.whop.com in script-src. That host
does not exist: DNS returns NXDOMAIN and the shipped @whop/checkout package
contains zero references to it. The sandbox checkout is framed from
sandbox.whop.com, which frame-src already covers. Allowlisting a dead host
was a no-op, but it misleads anyone copying the policy.

Verified: next build succeeds with only the four env vars the article lists.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant