cml comment create is giving unauthorization error

Open
#1,464 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
ci-cd, cli

Research direction

Start with src/drivers/gitlab.js at the request failure and trace how src/commenttarget.js invokes it for cml comment create report.md. Reproduce the command in a GitLab CI/CD pipeline using the reported context, then verify that the command authenticates successfully and creates the comment without the Unauthorized error.

Written by the indexing model from the issue text.

Description

When I use the command in gitlab ci/cd pipeline, getting the below error

cml comment create report.md

{"level":"warn","message":""cml send-comment" is deprecated, please use "cml comment create""}
{"level":"error","message":"Unauthorized","stack":"Error: Unauthorized\n at Gitlab.request (/usr/lib/node_modules/@dvcorg/cml/src/drivers/gitlab.js:573:13)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at async /usr/lib/node_modules/@dvcorg/cml/src/drivers/gitlab.js:54:16\n at async Promise.all (index 0)\n at async Gitlab.repoBase (/usr/lib/node_modules/@dvcorg/cml/src/drivers/gitlab.js:45:27)\n at async Gitlab.projectPath (/usr/lib/node_modules/@dvcorg/cml/src/drivers/gitlab.js:33:22)\n at async Gitlab.commitPrs (/usr/lib/node_modules/@dvcorg/cml/src/drivers/gitlab.js:108:25)\n at async parseCommentTarget (/usr/lib/node_modules/@dvcorg/cml/src/commenttarget.js:39:25)\n at async CML.commentCreate (/usr/lib/node_modules/@dvcorg/cml/src/cml.js:308:20)\n at async Object.exports.handler (/usr/lib/node_modules/@dvcorg/cml/bin/cml/comment/create.js:11:15)"}

Dominant language
JavaScript
Stars
4.2k
Forks
345
PR merge metrics
No merged PRs in 30d

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from iterative/cml

All issues in iterative/cml

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.