iterative/cml

cml comment create is giving unauthorization error

bhaswa opened this issue · 2 comments

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)"}

Hello, @bhaswa! Please make sure that your token is valid.

I have the same error for the GitHub Actions pipeline

{"code":"ERR_INVALID_URL","input":"<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n<hr><center>cloudflare</center>\r\n</body>\r\n</html>\r\n","level":"error","message":"Invalid URL","stack":"TypeError [ERR_INVALID_URL]: Invalid URL\n at new NodeError (node:internal/errors:405:5)\n at new URL (node:internal/url:676:13)\n at uriParam (/usr/local/lib/node_modules/@dvcorg/cml/src/utils.js:149:15)\n at watermarkUri (/usr/local/lib/node_modules/@dvcorg/cml/src/utils.js:140:10)\n at CML.publish (/usr/local/lib/node_modules/@dvcorg/cml/src/cml.js:351:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async visitor (/usr/local/lib/node_modules/@dvcorg/cml/src/cml.js:249:26)\n at async Promise.all (index 0)\n at async publishLocalFiles (/usr/local/lib/node_modules/@dvcorg/cml/src/cml.js:263:7)"}