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.
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
- Set
LHCI_SERVER_BASE_URLandLHCI_TOKEN(orLHCI_GITHUB_APP_TOKEN) in the step env from secrets. - Confirm the config
upload.targetislhci. - Re-run the upload.
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
{ "ci": { "upload": { "target": "temporary-public-storage" } } }How to prevent it
- Set
serverBaseUrland the build token when using the lhci server target. - Use
temporary-public-storageorfilesystemwhen no server is available. - Keep LHCI tokens in CI secrets, mapped into the step env.