Skip to content

Error in request to create release #192

@renatocassino

Description

@renatocassino

Hello everyone

I'm receiving an error when I run the semantic release in last step. The code can create the tag, but after this, there is a request to /release that I'm receiving a 400 error code

[3:27:32 PM] [semantic-release] [@semantic-release/changelog] › ℹ  Create /tmp/build/group/project-name/CHANGELOG.md
[3:27:32 PM] [semantic-release] › ✔  Completed step "prepare" of plugin "@semantic-release/changelog"
[3:27:33 PM] [semantic-release] › ✔  Created tag v1.3.1
[3:27:33 PM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/gitlab"
[3:27:33 PM] [semantic-release] › ✖  Failed step "publish" of plugin "@semantic-release/gitlab"
[3:27:33 PM] [semantic-release] › ✖  An error occurred while running semantic-release: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise.js:118:31)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  pluginName: '@semantic-release/gitlab'
}
HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise.js:118:31)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  pluginName: '@semantic-release/gitlab'
}

I start to investigate the problem in code and I put a debug with error message in API:

2020-12-17T16:59:53.675Z semantic-release:gitlab error in request: Response code 400 (Bad Request)
2020-12-17T16:59:53.675Z semantic-release:gitlab {"error":"name is missing"}

Is required a field called name in json data send with GOT.

gitlab/lib/publish.js

Lines 73 to 87 in f8957c3

json: {
/* eslint-disable camelcase */
tag_name: gitTag,
description: notes && notes.trim() ? notes : gitTag,
assets: {
links: assetsList.map(({label, alt, url}) => {
return {
name: label || alt,
url: urlJoin(gitlabUrl, repoId, url),
};
}),
},
/* eslint-enable camelcase */
},
});

There is no field called name in this file

I changed and add a name with any value and I received a 201 code.

Is this a bug, different version or I made something wrong?

Thanks for this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions