Skip to content
Latchkey

Lighthouse CI "Unable to determine Lighthouse CI server" in CI

The lhci upload step needs a target. When set to the LHCI server but the server address or build token is missing, it cannot determine where to send results and fails the upload.

What this error means

The lhci upload step fails with a message that it cannot determine the Lighthouse CI server address or that the LHCI_SERVER_BASE_URL / token is not set.

lighthouse
Error: Unable to determine Lighthouse CI server. Set serverBaseUrl in your config
or the LHCI_SERVER_BASE_URL environment variable.
Build token (LHCI_TOKEN) is also required for the lhci target.

Common causes

The server URL or token is not provided

With target: "lhci", the upload needs serverBaseUrl and a build token; if neither config nor env supplies them, the step cannot proceed.

The wrong upload target for the setup

Using the lhci server target without a running server (instead of temporary-public-storage or filesystem) leaves no destination.

How to fix it

Provide the server URL and token

  1. Set LHCI_SERVER_BASE_URL and LHCI_TOKEN (or LHCI_GITHUB_APP_TOKEN) in the step env from secrets.
  2. Confirm the config upload.target is lhci.
  3. Re-run the upload.
.github/workflows/ci.yml
env:
  LHCI_SERVER_BASE_URL: ${{ secrets.LHCI_SERVER_BASE_URL }}
  LHCI_TOKEN: ${{ secrets.LHCI_TOKEN }}

Use a storage target that needs no server

If you do not run an LHCI server, upload to temporary public storage so no address or token is required.

lighthouserc.json
// lighthouserc.json
{ "ci": { "upload": { "target": "temporary-public-storage" } } }

How to prevent it

  • Set serverBaseUrl and the build token when using the lhci server target.
  • Use temporary-public-storage or filesystem when no server is available.
  • Keep LHCI tokens in CI secrets, mapped into the step env.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →