Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Danger fails to create inline comments on Gitlab #1412

Open
dimsuz opened this issue Nov 4, 2023 · 3 comments
Open

[BUG] Danger fails to create inline comments on Gitlab #1412

dimsuz opened this issue Nov 4, 2023 · 3 comments
Labels

Comments

@dimsuz
Copy link

dimsuz commented Nov 4, 2023

Describe the bug
I am using self-hosted gitlab and doing this in dangerfile.ts:

message("Add something please", "dangerfile.ts", 10)

Causes this error in logs (I rerun with debug logs enabled):

2023-11-04T12:59:01.986Z danger:GitLabAPI createMergeRequestDiscussion myapp/myapp-android 34
<!--
  0 failure:
  0 warning:
  1 messages

  DangerID: danger-id-Danger;
  File: dangerfile.ts;
  Line: 10;
-->
- :book: Add something please
   {
  position: {
    position_type: 'text',
    base_sha: '4262b65dde38269fbfa91f1ddeacc4791e742414',
    start_sha: '4262b65dde38269fbfa91f1ddeacc4791e742414',
    head_sha: '3d5c791cb2adc7f7e8314e6b77cbf36a339c6796',
    old_path: 'dangerfile.ts',
    old_line: undefined,
    new_path: 'dangerfile.ts',
    new_line: 10
  }
}
2023-11-04T12:59:01.988Z danger:GitLabAPI createMergeRequestDiscussion TypeError: Cannot read properties of undefined (reading 'name')
    at FormData._getContentDisposition (/node_modules/form-data/lib/form_data.js:227:40)
    at FormData._multiPartHeader (/node_modules/form-data/lib/form_data.js:178:33)
    at FormData.append (/node_modules/form-data/lib/form_data.js:71:21)
    at /node_modules/@gitbeaker/core/dist/index.js:168:18
    at Array.forEach (<anonymous>)
    at appendFormFromObject (/node_modules/@gitbeaker/core/dist/index.js:163:28)
    at Object.<anonymous> (/node_modules/@gitbeaker/core/dist/index.js:257:41)
    at step (/node_modules/@gitbeaker/core/dist/index.js:121:23)
    at Object.next (/node_modules/@gitbeaker/core/dist/index.js:102:53)
    at /node_modules/@gitbeaker/core/dist/index.js:95:71

At the same time, a "global" table-comment is posted ok to the "Overview" section of the MR.
Access token has api, read_repository, read_user access rights. api one alone should be enough to post comments IIRC.

I'd be happy to help debug this further if needed.

Your Environment

software version
danger.js 11.3.0
node v18.13.0
npm 9.2.0
Operating System Debian 4.19.181-1 (2021-03-19)
@heltoft
Copy link
Contributor

heltoft commented Aug 29, 2024

This should be good now from v12.0.1 of danger-js.
@dimsuz could you verify?

@dimsuz
Copy link
Author

dimsuz commented Sep 2, 2024

@heltoft Sorry, won't be able to check this quickly. Maybe it's best you close it as fixed, I'll leave feedback if anything is wrong when I get to try it.

Thanks for looking into it!

@frantic1048
Copy link
Contributor

I can confirm that the latest [email protected] is properly creating inline comments on GitLab. 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants