# Troubleshooting (/docs/starter/troubleshooting)

Start with `pnpm clubedge doctor`. It checks Node.js and pnpm versions, conflict markers left by a change, installed dependencies, the lockfile, and the env files against their examples, then runs `pnpm check:services`.

<Accordions type="single">
  <Accordion title="pnpm cannot read package.json after a change">
    `add`, `remove`, or `upgrade` left conflict markers in a `package.json`, and pnpm stops on them, `pnpm clubedge` included. Resolve the markers, then run `pnpm install`. To see which file and compare it with the Starter's version, run the CLI directly: `pnpm dlx @clubedge/create-clubedge-app status` (CLI 0.41.0 or newer). See [Change a project](../cli/change-a-project.mdx#after-the-change).
  </Accordion>
  <Accordion title="Environment validation fails">
    Confirm you copied the example to `apps/web/.env.local` and set `DATABASE_URL`. The error names the module whose variables are invalid. With a separate API, or without a website, the API reads `apps/api/.env.local`, from `apps/api/.env.example`, and `DATABASE_URL` belongs there.
  </Accordion>
  <Accordion title="Auth redirects fail (Supabase Auth)">
    Add the exact local or deployed `/auth/callback` URL to Supabase Auth's allowed redirect URLs. On React + Vite, add the `/login` and `/reset-password` URLs instead. See [Authentication](./modules/auth.mdx).
  </Accordion>
  <Accordion title="Signed in, but the API sees no user (React + Vite)">
    Check that the API has the provider's server variables for the same project as the frontend's `VITE_*` values, and that the frontend was built with them. With `VITE_API_URL` set, the browser calls the API directly: set the API's `FRONTEND_URL` to the frontend's exact origin, which its CORS allows. With Better Auth, leave `VITE_API_URL` blank and set `BETTER_AUTH_URL` on both apps. With Firebase and Appwrite, the address must be confirmed first.
  </Accordion>
  <Accordion title="An API endpoint answers 404 in production (React + Vite)">
    The frontend's production server forwards only the contract's `GET /api/health`, `/api/ready`, and `/api/session`, the endpoints of the modules you chose, and `/api/auth/*` with Better Auth, although the dev server forwards all of `/api`. Add a new endpoint to `apiRoutes` in `apps/web/server.mjs`, or set `VITE_API_URL` so the browser calls the API directly.
  </Accordion>
  <Accordion title="The mobile app cannot reach the API">
    Check that `WEB_URL` in `apps/shell/.env.local` is the deployed website's `https://` address, and that the website's `MOBILE_ORIGINS` lists the app's origins (`capacitor://localhost,https://localhost` by default). Then run `pnpm --filter @clubedge/shell sync` again. See [The mobile app](./mobile-app.mdx).
  </Accordion>
  <Accordion title="The native app cannot reach the API">
    Check `EXPO_PUBLIC_API_URL` in `apps/mobile/.env.local`. A release build needs the website's `https://` address, or the API's without a website, and a phone in development your computer's address on the same network, with port 3001 without a website. The value is built into the app, so build it again after changing it. See [The native app](./native-app.mdx#when-the-app-cant-reach-the-api).
  </Accordion>
  <Accordion title="Emailed links don't open the native app (Supabase Auth)">
    Without a website, Supabase's confirmation and password reset links open the app through its address scheme once Supabase's Redirect URLs list it: add it, such as `my-product://**`. The local Supabase stack reads them from `additional_redirect_urls` in `supabase/config.toml`; restart it after adding the scheme. With a website, the links open the website instead.
  </Accordion>
  <Accordion title="Rate limits treat every visitor as one">
    Rate limits count requests per client address. Behind a proxy, without the setting for your host, the server can see the proxy's address on every request, so visitors share one count. Set `CLIENT_IP_HEADER` or `TRUSTED_PROXY_HOPS` for your host (Starter v0.27.0 or newer); `pnpm clubedge deploy` sets it for you. See [Client addresses](./before-deploying.mdx#client-addresses).
  </Accordion>
  <Accordion title="Database connection fails">
    Check the URL, network access, and whether your provider expects a transaction pooler. Keep `prepare: false` for the current Supabase pooler setup.
  </Accordion>
  <Accordion title="Redis cannot connect">
    Check that the URL uses `redis://` or `rediss://`, credentials are current, and outbound TCP access is allowed.
  </Accordion>
  <Accordion title="Playwright cannot find Chromium">
    Run `pnpm exec playwright install chromium`.
  </Accordion>
  <Accordion title="A package file appears missing after an offline install">
    Retry with a normal registry-backed `pnpm install`; an incomplete local package cache can satisfy offline resolution while leaving package contents incomplete.
  </Accordion>
  <Accordion title="pnpm ignored a build script">
    Review the package name and approve only the required dependency with `pnpm approve-builds`.
  </Accordion>
</Accordions>

## Get help [#get-help]

- [CLI issues](https://github.com/Clubedge/create-clubedge-app/issues) for problems creating, changing, or upgrading a project.
- [Starter issues](https://github.com/Clubedge/clubedge-starter/issues) for problems in the generated application itself.
- Security problems go through the private process in the Starter's [SECURITY.md](https://github.com/Clubedge/clubedge-starter/blob/main/SECURITY.md), not public issues.
