# Cloudflare Pages — troubleshooting

Common errors and quick fixes for Cloudflare Pages deploys.

---

## Error: TypeScript unused imports/variables

**Symptom:**
error TS6196: 'X' is declared but never used.
Failed: build command exited with code: 1

**Cause:**
TypeScript in strict mode (`tsc -b`) fails on unused imports or variables.

**Fix:**

1. Open the file mentioned in the error.
2. Remove the unused import / variable.
3. Commit and push.

**Real example (2026-01-25):**
src/components/templateDesigner/preview/PreviewPanel.tsx(9,34): error TS6196: 'TemplateOption' is declared but never used.

Fix: # Before
import type { PreviewPanelProps, TemplateOption } from '../types';

    # After
    import type { PreviewPanelProps } from '../types';

---

## Error: Build timeout

**Symptom:**
Build hangs or exceeds the time limit.

**Cause:**

- Very heavy dependencies
- An infinite build process

**Fix:**

1. Check `package.json` scripts
2. Look for loops in the build
3. Consider trimming dependencies

---

## Error: Missing environment variables

**Symptom:**
ReferenceError: process is not defined
Cannot read property 'VITE_X' of undefined

**Cause:**
Environment variables not configured in Cloudflare.

**Fix:**

1. Go to Cloudflare Dashboard → Pages → Project → Settings → Environment variables
2. Add the missing variables
3. Re-deploy

---

## Check deploy status

1. Go to: https://dash.cloudflare.com
2. Pages → select the project
3. Open "Deployments" for the detailed logs

---

## Projects on Cloudflare Pages

| Project  | GitHub repo                             | URL                       |
| -------- | --------------------------------------- | ------------------------- |
| Master   | capitaharlock/master.cryptonite.trade   | master.cryptonite.trade   |
| Broker   | capitaharlock/broker.cryptonite.trade   | broker.cryptonite.trade   |
| Webapp   | capitaharlock/webapp.cryptonite.trade   | app.cryptonite.trade      |
| PSMailer | capitaharlock/psmailer.cryptonite.trade | psmailer.cryptonite.trade |

---

## Force a rebuild

If auto-deploy isn't firing:

1. Cloudflare Dashboard → Pages → project
2. "Deployments" → "Retry deployment" on the latest commit
3. Or push an empty commit: `git commit --allow-empty -m "trigger rebuild" && git push`
