datadog-ci "Missing DATADOG_API_KEY" in CI
datadog-ci reads the API key from the environment, and when DATADOG_API_KEY (or DD_API_KEY) is empty it stops immediately with "Missing DATADOG_API_KEY in your environment." No request reaches Datadog.
What this error means
A datadog-ci subcommand (sourcemaps, junit, synthetics) exits non-zero with "Missing DATADOG_API_KEY in your environment." before uploading anything.
datadog-ci
[ERROR] Missing DATADOG_API_KEY in your environment.Common causes
The API key secret is not exposed to the step
The workflow never set DATADOG_API_KEY, or used a different name, so datadog-ci finds nothing to authenticate with.
The run is on a fork without secrets
Pull requests from forks do not receive repository secrets, so the key resolves to empty in that context.
How to fix it
Export DATADOG_API_KEY from a secret
- Store the Datadog API key as a CI secret.
- Expose it as
DATADOG_API_KEYin the step env. - Re-run the datadog-ci command.
.github/workflows/ci.yml
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
run: datadog-ci junit upload --service web ./reportsGuard against an empty key
Fail fast with a clear message if the variable is missing, instead of a deep error later.
Terminal
test -n "$DATADOG_API_KEY" || { echo "DATADOG_API_KEY is empty"; exit 1; }How to prevent it
- Set the API key from a secret at the job level.
- Use the exact env name datadog-ci expects (
DATADOG_API_KEY). - Skip Datadog uploads on fork-triggered runs where secrets are absent.
Related guides
datadog-ci "403 Forbidden" invalid API key in CIFix datadog-ci "403 Forbidden" / "API key is not valid" in CI - a key was sent but Datadog rejected it as inv…
datadog-ci "synthetics test failed" in CIFix datadog-ci synthetics run-tests failures in CI - one or more Synthetic tests returned a failed result and…
sentry-cli "Auth token is required for this request" in CIFix sentry-cli "error: Auth token is required for this request" in CI - the CLI aborted before contacting Sen…