Skip to content

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

@dimsuz

Description

@dimsuz

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions