DataDog / datadog-ci

Use Datadog from your CI.
https://datadoghq.com
Apache License 2.0
128 stars 55 forks source link

FORBIDDEN DORA CI Deployment - Axios Error #1481

Closed crystalworks closed 2 weeks ago

crystalworks commented 2 weeks ago

Bug description

When trying to use the dora deployment COMMAND, I get forbidden even though all parameters appear to be correct.

e.g. of command

.\datadog-ci.exe dora deployment --service 'my.shopping..api' --env 'dev' --started-at '1730109643' --finished-at '1730109795' --git-repository-url 'https://dev.azure.com/my-organisation/myproject/_git/my.shopping.Api' --git-commit-sha '40characterSHA'

with regards to ddkey and site, I know these works as I have the metadata upload command running in the same task (for debugging) and it works fine.

The CI pipeline is visible within Datadog so pre-reqs I believe are met.

Sending DORA deployment event for service: my.shopping.api ❌ Failed to send DORA deployment event for service: my.shopping.api: { "errors": [ "Forbidden" ] } Axios Error: Request failed with status code 403 at settle (C:\snapshot\datadog-ci\node_modules\axios\dist\node\axios.cjs:2015:12) at IncomingMessage.handleStreamEnd (C:\snapshot\datadog-ci\node_modules\axios\dist\node\axios.cjs:3131:11) at IncomingMessage.emit (events.js:412:35) at endReadableNT (internal/streams/readable.js:1334:12) at processTicksAndRejections (internal/process/task_queues.js:82:21) at Axios.request (C:\snapshot\datadog-ci\node_modules\axios\dist\node\axios.cjs:4262:41) at processTicksAndRejections (internal/process/task_queues.js:95:5)

Describe what you expected

I expected output which signified the event executed correctly.

Steps to reproduce the issue

configure azure devops pipeline with windows agent, enable BETA via env var and configure cmd with correct parameters.

Additional context

Command

None

crystalworks commented 2 weeks ago

Just tested a home baked powershell version to talk to the API and it works with the exact variables I had in a failed run, I suspect an error in the typescript code exists

crystalworks commented 2 weeks ago

it turned out to be the environment variables. instead of DATADOG-API-KEY and DATADOG-SITE, it follows the traditional pattern of DD-API-KEY and DD_SITE. it would probably make sense to have the environment variables follow the same pattern everywhere