Skip to content

fix(cli): give a clear error on deploy when required env vars are missing#3097

Draft
jorgemoya wants to merge 1 commit into
canaryfrom
jorgemoya/ltrac-1090-ugly-build-error-on-catalyst-deploy-when-required-env-vars
Draft

fix(cli): give a clear error on deploy when required env vars are missing#3097
jorgemoya wants to merge 1 commit into
canaryfrom
jorgemoya/ltrac-1090-ugly-build-error-on-catalyst-deploy-when-required-env-vars

Conversation

@jorgemoya

Copy link
Copy Markdown
Contributor

Linear: LTRAC-1090

What/Why?

Running catalyst deploy without the required environment variables produced an ugly raw build stack trace with no hint that missing env vars were the cause (the fix is --env-path, but nothing said so). This detects the missing-required-env condition before the build and fails with a UserActionableError that names the missing variables and points at --env-path and the likely .env.local location, instead of surfacing the raw build error.

See the PR diff for how "required" vars are determined; the check is intentionally minimal and targeted at the vars the core build asserts on.

Testing

  • New required-build-env.spec.ts + build.spec.ts — 9 tests pass, covering the missing-env path and the pass-through case.
  • typecheck and lint pass.

Migration

None.

…sing

`catalyst deploy` (and the Commerce Hosting `catalyst build` path) surfaced a
raw OpenNext/Next.js build stack trace when required env vars weren't loaded —
the values are read during prerender, so a missing/empty `BIGCOMMERCE_STORE_HASH`,
`BIGCOMMERCE_STOREFRONT_TOKEN`, or `AUTH_SECRET` failed deep in the build with no
hint about the cause or the fix.

Pre-check these vars in `buildCatalystProject` before shelling out to the build.
When any are missing we throw a `UserActionableError` (printed plainly, without
the Correlation-ID bug-report framing) that names each missing variable and
suggests loading a `.env.local` via `--env-path`, so the ugly build error never
happens.

Refs LTRAC-1090
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
catalyst Building Building Preview Jul 10, 2026 3:54pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 63a52cb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Report

Comparing against baseline from 8d9f9a9 (2026-07-10).

No bundle size changes detected.

@github-actions

Copy link
Copy Markdown
Contributor

Unlighthouse Performance Comparison — Vercel

Comparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores.

Summary Score

Aggregate score across all categories as reported by Unlighthouse.

Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Score 90 92 92 94

Category Scores

Category Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Performance 75 89 72 77
Accessibility 95 98 95 95
Best Practices 100 100 100 100
SEO 100 88 100 100

Core Web Vitals

Metric Prod Desktop Prod Mobile Preview Desktop Preview Mobile
LCP 3.7 s 3.8 s 4.5 s 6.6 s
CLS 0 0 0.039 0
FCP 1.2 s 1.2 s 1.2 s 1.2 s
TBT 10 ms 0 ms 0 ms 0 ms
Max Potential FID 50 ms 50 ms 50 ms 50 ms
Time to Interactive 3.7 s 3.8 s 4.5 s 6.6 s

Full Unlighthouse report →

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