13.2.0 causes 422 (Unprocessable Entity) due to missing ref
After updating from 13.1.0 to 13.2.0 releases are now failing with 422 (Unprocessable Entity):
[7:41:59 AM] [semantic-release] › ✔ Created tag v1.1.1
[7:41:59 AM] [semantic-release] › ℹ Start step "publish" of plugin "@semantic-release/gitlab"
[7:42:00 AM] [semantic-release] [@semantic-release/gitlab] › ✘ An error occurred while making a request to the GitLab release API:
HTTPError: Response code 422 (Unprocessable Entity)
at Request.<anonymous> (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise/index.js:92:42)
at Object.onceWrapper (node:events:634:26)
at Request.emit (node:events:531:35)
at Request._onResponseBase (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/core/index.js:604:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Request._onResponse (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/core/index.js:646:13) {
input: undefined,
code: 'ERR_NON_2XX_3XX_RESPONSE',
POST'ing the same body using cURL on the CLI results in a more clear error message:
{"message":"Ref is not specified"}
Also, according to the release notes this error message should have been logged directly by this plugin but does not appear to be the case in this particular instance.
Hi @syphernl. Can you share:
- your semantic-release configuration?
- maybe all of the logs?
- maybe even the repository?
- and what Gitlab version are you using - self hosted or gitlab.com?
I am asking because I am not able to reproduce your issue. All of our repositories which are using version 13.2.0 are succeeding without problems.
As for the logging:
The logging was adjusted to the configurations which were introduced in 13.1.0. The error message now returns The message of the parsed response body.
I agree with you though, that we can improve it further to log if possible more details.
We run Semantic-release 24.0.0 on our self-hosted (private) GitLab instance.
Downgrading the plugin to 13.1.0 makes it properly release again. I expected the logs of this plugin/semantic-release to contain the "Ref is not specified" error I got when it tried to release.
Thanks for sharing the information @syphernl!
Downgrading the plugin to
13.1.0makes it properly release again. I expected the logs of this plugin/semantic-release to contain the "Ref is not specified" error I got when it tried to release.
Just to re-iterate: The exact same commit releases properly with 13.1.0 and fails with 13.2.0?
Would you mind sharing your configuration?
Just to re-iterate: The exact same commit releases properly with 13.1.0 and fails with 13.2.0?
Yes, the commit failed with 13.2.0 and worked fine once we downgraded back to 13.1.0:
The config:
{
plugins: [
["@semantic-release/commit-analyzer", {
"preset": "angular",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
},
"releaseRules": [
{"type": "build", "release": "patch"},
{"type": "deploy", "release": "patch"},
{"type": "chore", "release": "patch"},
{"type": "docs", "release": "patch"},
{"type": "test", "release": "patch"},
{"type": "style", "release": "patch"},
{"type": "ci", "release": "patch"}
]
}],
['@semantic-release/release-notes-generator', {
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
},
"writerOpts": {
"commitsSort": ["subject", "scope"]
},
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Chores",
"hidden": false
},
{
"type": "refactor",
"section": "Internal",
"hidden": false
},
{
"type": "perf",
"section": "Performance",
"hidden": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
},
{
"type": "ci",
"section": "DevOps",
"hidden": false
},
{
"type": "test",
"section": "Tests",
"hidden": false
}
]
}
}],
['@semantic-release/gitlab', {
'successComment': ':tada: This ${issue ? "issue" : "MR"} is included in version [v${nextRelease.version}](${releases.filter(release => /gitlab\.REDACTED\.COM/i.test(release.url))[0].url}).',
}]
],
branches: [
'master', 'production',
{name: 'staging', prerelease: true},
]
}
The logs:
[7:41:58 AM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[7:41:58 AM] [semantic-release] › ℹ The next release version is 1.1.1
[7:41:58 AM] [semantic-release] › ℹ Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[7:41:58 AM] [semantic-release] › ✔ Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[7:41:59 AM] [semantic-release] › ✔ Created tag v1.1.1
[7:41:59 AM] [semantic-release] › ℹ Start step "publish" of plugin "@semantic-release/gitlab"
[7:42:00 AM] [semantic-release] [@semantic-release/gitlab] › ✘ An error occurred while making a request to the GitLab release API:
HTTPError: Response code 422 (Unprocessable Entity)
at Request.<anonymous> (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise/index.js:92:42)
at Object.onceWrapper (node:events:634:26)
at Request.emit (node:events:531:35)
at Request._onResponseBase (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/core/index.js:604:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Request._onResponse (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/core/index.js:646:13) {
input: undefined,
code: 'ERR_NON_2XX_3XX_RESPONSE',
timings: {
start: 1720510919933,
socket: 1720510919933,
lookup: 1720510919933,
connect: 1720510919933,
secureConnect: 1720510919933,
upload: 1720510919934,
response: 1720510920220,
end: 1720510920221,
error: undefined,
abort: undefined,
phases: {
wait: 0,
dns: 0,
tcp: 0,
tls: 0,
request: 1,
firstByte: 286,
download: 1,
total: 288
}
},
options: {
request: undefined,
agent: { http: undefined, https: undefined, http2: undefined },
h2session: undefined,
decompress: true,
timeout: {
connect: undefined,
lookup: undefined,
read: undefined,
request: undefined,
response: undefined,
secureConnect: undefined,
send: undefined,
socket: undefined
},
prefixUrl: '',
body: '{"tag_name":"v1.1.1","description":"## [1.1.1](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/compare/v1.1.0...v1.1.1) (2024-07-09)\\n\\n\\n### Bug Fixes\\n\\n* **tg:** correct no prod changes label logic ([48f7a3d](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/48f7a3d57e65cc3c584bec2e5f1a5ecf86d0f6cc))\\n\\n\\n### Chores\\n\\n* **deps:** update REDACTED/tools/ci-cd to v0.59.4 ([7fda339](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/7fda3394cd98c4c0a0959861cca9af26d89f82f6))\\n* **deps:** update REDACTED/tools/ci-cd to v0.60.0 ([1345563](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/1345563b23e218927074c84cc9fe170122fd32dc))\\n* **deps:** update REDACTED/tools/ci-cd to v0.60.1 ([1c7c1ae](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/1c7c1aecdba76fe5e95941098906561e5464b082))\\n\\n","assets":{"links":[]}}',
form: undefined,
json: undefined,
cookieJar: undefined,
ignoreInvalidCookies: [secure],
searchParams: undefined,
dnsLookup: undefined,
dnsCache: undefined,
context: {},
hooks: {
init: [],
beforeRequest: [],
beforeError: [],
beforeRedirect: [],
beforeRetry: [],
afterResponse: []
},
followRedirect: true,
maxRedirects: 10,
cache: undefined,
throwHttpErrors: true,
username: '',
password: '',
http2: [secure],
allowGetBody: [secure],
headers: {
'user-agent': 'got (https://github.com/sindresorhus/got)',
'private-token': '[secure]',
'content-type': 'application/json',
'content-length': '862',
'accept-encoding': 'gzip, deflate, br'
},
methodRewriting: [secure],
dnsLookupIpVersion: undefined,
parseJson: [Function: parse],
stringifyJson: [Function: stringify],
retry: {
limit: 2,
methods: [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ],
statusCodes: [
408, 413, 429, 500,
502, 503, 504, 521,
522, 524
],
errorCodes: [
'ETIMEDOUT',
'ECONNRESET',
'EADDRINUSE',
'ECONNREFUSED',
'EPIPE',
'ENOTFOUND',
'ENETUNREACH',
'EAI_AGAIN'
],
maxRetryAfter: undefined,
calculateDelay: [Function: calculateDelay],
backoffLimit: Infinity,
noise: 100
},
localAddress: undefined,
method: 'POST',
createConnection: undefined,
cacheOptions: {
shared: undefined,
cacheHeuristic: undefined,
immutableMinTimeToLive: undefined,
ignoreCargoCult: undefined
},
https: {
alpnProtocols: undefined,
rejectUnauthorized: undefined,
checkServerIdentity: undefined,
certificateAuthority: undefined,
key: undefined,
certificate: undefined,
passphrase: undefined,
pfx: undefined,
ciphers: undefined,
honorCipherOrder: undefined,
minVersion: undefined,
maxVersion: undefined,
signatureAlgorithms: undefined,
tlsSessionLifetime: undefined,
dhparam: undefined,
ecdhCurve: undefined,
certificateRevocationLists: undefined
},
encoding: undefined,
resolveBodyOnly: [secure],
isStream: [secure],
responseType: 'text',
url: URL {
href: 'https://gitlab.REDACTED.COM/api/v4/projects/REDACTED%2Ftools%2Fterraform-ci-cd/releases',
origin: 'https://gitlab.REDACTED.COM',
protocol: 'https:',
username: '',
password: '',
host: 'gitlab.REDACTED.COM',
hostname: 'gitlab.REDACTED.COM',
port: '',
pathname: '/api/v4/projects/REDACTED%2Ftools%2Fterraform-ci-cd/releases',
search: '',
searchParams: URLSearchParams {},
hash: ''
},
pagination: {
transform: [Function: transform],
paginate: [Function: paginate],
filter: [Function: filter],
shouldContinue: [Function: shouldContinue],
countLimit: Infinity,
backoff: 0,
requestLimit: 10000,
stackAllItems: [secure]
},
setHost: true,
maxHeaderSize: undefined,
signal: undefined,
enableUnixSockets: [secure]
},
[cause]: {}
}
[7:42:00 AM] [semantic-release] › ✘ Failed step "publish" of plugin "@semantic-release/gitlab"
[7:42:00 AM] [semantic-release] › ✘ An error occurred while running semantic-release: HTTPError: Response code 422 (Unprocessable Entity)
at Request.<anonymous> (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise/index.js:92:42)
at Object.onceWrapper (node:events:634:26)
at Request.emit (node:events:531:35)
at Request._onResponseBase (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/core/index.js:604:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Request._onResponse (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/core/index.js:646:13) {
input: undefined,
code: 'ERR_NON_2XX_3XX_RESPONSE',
timings: {
start: 1720510919933,
socket: 1720510919933,
lookup: 1720510919933,
connect: 1720510919933,
secureConnect: 1720510919933,
upload: 1720510919934,
response: 1720510920220,
end: 1720510920221,
error: undefined,
abort: undefined,
phases: {
wait: 0,
dns: 0,
tcp: 0,
tls: 0,
request: 1,
firstByte: 286,
download: 1,
total: 288
}
},
options: {
request: undefined,
agent: { http: undefined, https: undefined, http2: undefined },
h2session: undefined,
decompress: true,
timeout: {
connect: undefined,
lookup: undefined,
read: undefined,
request: undefined,
response: undefined,
secureConnect: undefined,
send: undefined,
socket: undefined
},
prefixUrl: '',
body: '{"tag_name":"v1.1.1","description":"## [1.1.1](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/compare/v1.1.0...v1.1.1) (2024-07-09)\\n\\n\\n### Bug Fixes\\n\\n* **tg:** correct no prod changes label logic ([48f7a3d](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/48f7a3d57e65cc3c584bec2e5f1a5ecf86d0f6cc))\\n\\n\\n### Chores\\n\\n* **deps:** update REDACTED/tools/ci-cd to v0.59.4 ([7fda339](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/7fda3394cd98c4c0a0959861cca9af26d89f82f6))\\n* **deps:** update REDACTED/tools/ci-cd to v0.60.0 ([1345563](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/1345563b23e218927074c84cc9fe170122fd32dc))\\n* **deps:** update REDACTED/tools/ci-cd to v0.60.1 ([1c7c1ae](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/1c7c1aecdba76fe5e95941098906561e5464b082))\\n\\n","assets":{"links":[]}}',
form: undefined,
json: undefined,
cookieJar: undefined,
ignoreInvalidCookies: [secure],
searchParams: undefined,
dnsLookup: undefined,
dnsCache: undefined,
context: {},
hooks: {
init: [],
beforeRequest: [],
beforeError: [],
beforeRedirect: [],
beforeRetry: [],
afterResponse: []
},
followRedirect: true,
maxRedirects: 10,
cache: undefined,
throwHttpErrors: true,
username: '',
password: '',
http2: [secure],
allowGetBody: [secure],
headers: {
'user-agent': 'got (https://github.com/sindresorhus/got)',
'private-token': '[secure]',
'content-type': 'application/json',
'content-length': '862',
'accept-encoding': 'gzip, deflate, br'
},
methodRewriting: [secure],
dnsLookupIpVersion: undefined,
parseJson: [Function: parse],
stringifyJson: [Function: stringify],
retry: {
limit: 2,
methods: [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ],
statusCodes: [
408, 413, 429, 500,
502, 503, 504, 521,
522, 524
],
errorCodes: [
'ETIMEDOUT',
'ECONNRESET',
'EADDRINUSE',
'ECONNREFUSED',
'EPIPE',
'ENOTFOUND',
'ENETUNREACH',
'EAI_AGAIN'
],
maxRetryAfter: undefined,
calculateDelay: [Function: calculateDelay],
backoffLimit: Infinity,
noise: 100
},
localAddress: undefined,
method: 'POST',
createConnection: undefined,
cacheOptions: {
shared: undefined,
cacheHeuristic: undefined,
immutableMinTimeToLive: undefined,
ignoreCargoCult: undefined
},
https: {
alpnProtocols: undefined,
rejectUnauthorized: undefined,
checkServerIdentity: undefined,
certificateAuthority: undefined,
key: undefined,
certificate: undefined,
passphrase: undefined,
pfx: undefined,
ciphers: undefined,
honorCipherOrder: undefined,
minVersion: undefined,
maxVersion: undefined,
signatureAlgorithms: undefined,
tlsSessionLifetime: undefined,
dhparam: undefined,
ecdhCurve: undefined,
certificateRevocationLists: undefined
},
encoding: undefined,
resolveBodyOnly: [secure],
isStream: [secure],
responseType: 'text',
url: URL {
href: 'https://gitlab.REDACTED.COM/api/v4/projects/REDACTED%2Ftools%2Fterraform-ci-cd/releases',
origin: 'https://gitlab.REDACTED.COM',
protocol: 'https:',
username: '',
password: '',
host: 'gitlab.REDACTED.COM',
hostname: 'gitlab.REDACTED.COM',
port: '',
pathname: '/api/v4/projects/REDACTED%2Ftools%2Fterraform-ci-cd/releases',
search: '',
searchParams: URLSearchParams {},
hash: ''
},
pagination: {
transform: [Function: transform],
paginate: [Function: paginate],
filter: [Function: filter],
shouldContinue: [Function: shouldContinue],
countLimit: Infinity,
backoff: 0,
requestLimit: 10000,
stackAllItems: [secure]
},
setHost: true,
maxHeaderSize: undefined,
signal: undefined,
enableUnixSockets: [secure]
},
pluginName: '@semantic-release/gitlab',
[cause]: {}
}
HTTPError: Response code 422 (Unprocessable Entity)
at Request.<anonymous> (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise/index.js:92:42)
at Object.onceWrapper (node:events:634:26)
at Request.emit (node:events:531:35)
at Request._onResponseBase (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/core/index.js:604:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Request._onResponse (file:///usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/core/index.js:646:13) {
input: undefined,
code: 'ERR_NON_2XX_3XX_RESPONSE',
timings: {
start: 1720510919933,
socket: 1720510919933,
lookup: 1720510919933,
connect: 1720510919933,
secureConnect: 1720510919933,
upload: 1720510919934,
response: 1720510920220,
end: 1720510920221,
error: undefined,
abort: undefined,
phases: {
wait: 0,
dns: 0,
tcp: 0,
tls: 0,
request: 1,
firstByte: 286,
download: 1,
total: 288
}
},
options: {
request: undefined,
agent: { http: undefined, https: undefined, http2: undefined },
h2session: undefined,
decompress: true,
timeout: {
connect: undefined,
lookup: undefined,
read: undefined,
request: undefined,
response: undefined,
secureConnect: undefined,
send: undefined,
socket: undefined
},
prefixUrl: '',
body: '{"tag_name":"v1.1.1","description":"## [1.1.1](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/compare/v1.1.0...v1.1.1) (2024-07-09)\\n\\n\\n### Bug Fixes\\n\\n* **tg:** correct no prod changes label logic ([48f7a3d](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/48f7a3d57e65cc3c584bec2e5f1a5ecf86d0f6cc))\\n\\n\\n### Chores\\n\\n* **deps:** update REDACTED/tools/ci-cd to v0.59.4 ([7fda339](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/7fda3394cd98c4c0a0959861cca9af26d89f82f6))\\n* **deps:** update REDACTED/tools/ci-cd to v0.60.0 ([1345563](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/1345563b23e218927074c84cc9fe170122fd32dc))\\n* **deps:** update REDACTED/tools/ci-cd to v0.60.1 ([1c7c1ae](https://gitlab.REDACTED.COM/REDACTED/tools/terraform-ci-cd/commit/1c7c1aecdba76fe5e95941098906561e5464b082))\\n\\n","assets":{"links":[]}}',
form: undefined,
json: undefined,
cookieJar: undefined,
ignoreInvalidCookies: [secure],
searchParams: undefined,
dnsLookup: undefined,
dnsCache: undefined,
context: {},
hooks: {
init: [],
beforeRequest: [],
beforeError: [],
beforeRedirect: [],
beforeRetry: [],
afterResponse: []
},
followRedirect: true,
maxRedirects: 10,
cache: undefined,
throwHttpErrors: true,
username: '',
password: '',
http2: [secure],
allowGetBody: [secure],
headers: {
'user-agent': 'got (https://github.com/sindresorhus/got)',
'private-token': '[secure]',
'content-type': 'application/json',
'content-length': '862',
'accept-encoding': 'gzip, deflate, br'
},
methodRewriting: [secure],
dnsLookupIpVersion: undefined,
parseJson: [Function: parse],
stringifyJson: [Function: stringify],
retry: {
limit: 2,
methods: [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ],
statusCodes: [
408, 413, 429, 500,
502, 503, 504, 521,
522, 524
],
errorCodes: [
'ETIMEDOUT',
'ECONNRESET',
'EADDRINUSE',
'ECONNREFUSED',
'EPIPE',
'ENOTFOUND',
'ENETUNREACH',
'EAI_AGAIN'
],
maxRetryAfter: undefined,
calculateDelay: [Function: calculateDelay],
backoffLimit: Infinity,
noise: 100
},
localAddress: undefined,
method: 'POST',
createConnection: undefined,
cacheOptions: {
shared: undefined,
cacheHeuristic: undefined,
immutableMinTimeToLive: undefined,
ignoreCargoCult: undefined
},
https: {
alpnProtocols: undefined,
rejectUnauthorized: undefined,
checkServerIdentity: undefined,
certificateAuthority: undefined,
key: undefined,
certificate: undefined,
passphrase: undefined,
pfx: undefined,
ciphers: undefined,
honorCipherOrder: undefined,
minVersion: undefined,
maxVersion: undefined,
signatureAlgorithms: undefined,
tlsSessionLifetime: undefined,
dhparam: undefined,
ecdhCurve: undefined,
certificateRevocationLists: undefined
},
encoding: undefined,
resolveBodyOnly: [secure],
isStream: [secure],
responseType: 'text',
url: URL {
href: 'https://gitlab.REDACTED.COM/api/v4/projects/REDACTED%2Ftools%2Fterraform-ci-cd/releases',
origin: 'https://gitlab.REDACTED.COM',
protocol: 'https:',
username: '',
password: '',
host: 'gitlab.REDACTED.COM',
hostname: 'gitlab.REDACTED.COM',
port: '',
pathname: '/api/v4/projects/REDACTED%2Ftools%2Fterraform-ci-cd/releases',
search: '',
searchParams: URLSearchParams {},
hash: ''
},
pagination: {
transform: [Function: transform],
paginate: [Function: paginate],
filter: [Function: filter],
shouldContinue: [Function: shouldContinue],
countLimit: Infinity,
backoff: 0,
requestLimit: 10000,
stackAllItems: [secure]
},
setHost: true,
maxHeaderSize: undefined,
signal: undefined,
enableUnixSockets: [secure]
},
pluginName: '@semantic-release/gitlab',
[cause]: {}
}
Thanks for sharing the logs @syphernl! I cannot see anything suspicious though.
Would you please enable debug mode and then provide log files of both the successful (using 13.1.0) as well the failing (using 13.2.0) run?
{"message":"Ref is not specified"}
FYI: The Releases API will respond with this error if the tag does not exist or could not be created.
Closing issue as this was for a previous employer and I cannot do any further troubleshooting because of this.