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

An error occurred while making a request to the GitLab release API - Response code 400 (Bad Request) #421

Closed
oliveirarafa opened this issue Jul 7, 2022 · 2 comments

Comments

@oliveirarafa
Copy link

oliveirarafa commented Jul 7, 2022

I'm having a problem when creating the release at gitlab. For what I can see the files as found, uploaded but for some reason the call to the API faills.

I'm using gitlab.com, have set up the access token.

Packages versions

    "@semantic-release/changelog": "^6.0.1",
    "@semantic-release/commit-analyzer": "^9.0.2",
    "@semantic-release/git": "^10.0.1",
    "@semantic-release/gitlab": "^9.3.2",
    "@semantic-release/npm": "^9.0.1",
    "@semantic-release/release-notes-generator": "^10.0.3",

Gitlab.com CI/CD Log

[8:06:48 PM] [semantic-release] › ✔  Created tag v1.0.0-beta.4
[8:06:48 PM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/gitlab"
2022-07-07T20:06:48.399Z semantic-release:gitlab repoId: 'govbr-ds/dev/wbc/govbr-ds-wbc'
2022-07-07T20:06:48.399Z semantic-release:gitlab release name: 'v1.0.0-beta.4'
2022-07-07T20:06:48.399Z semantic-release:gitlab release ref: '84b3d9bcfb6955619ade6981ec019e70e9e79bc1'
2022-07-07T20:06:48.399Z semantic-release:gitlab milestones: undefined
2022-07-07T20:06:48.400Z semantic-release:gitlab url assets: [ { url: 'https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/-/blob/main/README.md' } ]
2022-07-07T20:06:48.414Z semantic-release:gitlab globbed assets: [ { path: 'dist/webcomponents.css' }, { path: 'dist/webcomponents.umd.min.js', label: 'webcomponents.umd.min.js' }, { path: 'dist/webcomponents.umd.js', label: 'webcomponents.umd.js' }, { path: 'dist/webcomponents.common.js', label: 'webcomponents.common.js' } ]
2022-07-07T20:06:48.415Z semantic-release:gitlab all assets: [ { url: 'https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/-/blob/main/README.md' }, { path: 'dist/webcomponents.css' }, { path: 'dist/webcomponents.umd.min.js', label: 'webcomponents.umd.min.js' }, { path: 'dist/webcomponents.umd.js', label: 'webcomponents.umd.js' }, { path: 'dist/webcomponents.common.js', label: 'webcomponents.common.js' } ]
2022-07-07T20:06:48.415Z semantic-release:gitlab use link from release setting: https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/-/blob/main/README.md
2022-07-07T20:06:48.416Z semantic-release:gitlab file path: 'dist/webcomponents.css'
2022-07-07T20:06:48.417Z semantic-release:gitlab file label: undefined
2022-07-07T20:06:48.417Z semantic-release:gitlab file type: undefined
2022-07-07T20:06:48.417Z semantic-release:gitlab file filepath: undefined
2022-07-07T20:06:48.419Z semantic-release:gitlab POST-ing the file /builds/govbr-ds/dev/wbc/govbr-ds-wbc/dist/webcomponents.css to https://gitlab.com/api/v4/projects/govbr-ds%2Fdev%2Fwbc%2Fgovbr-ds-wbc/uploads
2022-07-07T20:06:48.421Z semantic-release:gitlab file path: 'dist/webcomponents.umd.min.js'
2022-07-07T20:06:48.421Z semantic-release:gitlab file label: 'webcomponents.umd.min.js'
2022-07-07T20:06:48.422Z semantic-release:gitlab file type: undefined
2022-07-07T20:06:48.422Z semantic-release:gitlab file filepath: undefined
2022-07-07T20:06:48.422Z semantic-release:gitlab POST-ing the file /builds/govbr-ds/dev/wbc/govbr-ds-wbc/dist/webcomponents.umd.min.js to https://gitlab.com/api/v4/projects/govbr-ds%2Fdev%2Fwbc%2Fgovbr-ds-wbc/uploads
2022-07-07T20:06:48.423Z semantic-release:gitlab file path: 'dist/webcomponents.umd.js'
2022-07-07T20:06:48.424Z semantic-release:gitlab file label: 'webcomponents.umd.js'
2022-07-07T20:06:48.424Z semantic-release:gitlab file type: undefined
2022-07-07T20:06:48.424Z semantic-release:gitlab file filepath: undefined
2022-07-07T20:06:48.424Z semantic-release:gitlab POST-ing the file /builds/govbr-ds/dev/wbc/govbr-ds-wbc/dist/webcomponents.umd.js to https://gitlab.com/api/v4/projects/govbr-ds%2Fdev%2Fwbc%2Fgovbr-ds-wbc/uploads
2022-07-07T20:06:48.425Z semantic-release:gitlab file path: 'dist/webcomponents.common.js'
2022-07-07T20:06:48.426Z semantic-release:gitlab file label: 'webcomponents.common.js'
2022-07-07T20:06:48.426Z semantic-release:gitlab file type: undefined
2022-07-07T20:06:48.426Z semantic-release:gitlab file filepath: undefined
2022-07-07T20:06:48.426Z semantic-release:gitlab POST-ing the file /builds/govbr-ds/dev/wbc/govbr-ds-wbc/dist/webcomponents.common.js to https://gitlab.com/api/v4/projects/govbr-ds%2Fdev%2Fwbc%2Fgovbr-ds-wbc/uploads
[8:06:49 PM] [semantic-release] [@semantic-release/gitlab] › ℹ  Uploaded file: /uploads/95125aec2df36573b44c74757027066b/webcomponents.css
[8:06:49 PM] [semantic-release] [@semantic-release/gitlab] › ℹ  Uploaded file: /uploads/c94864688058ceb1b8cb0753626960ef/webcomponents.umd.min.js
[8:06:49 PM] [semantic-release] [@semantic-release/gitlab] › ℹ  Uploaded file: /uploads/938987bc9c82e014fa6153e55e472e56/webcomponents.common.js
[8:06:49 PM] [semantic-release] [@semantic-release/gitlab] › ℹ  Uploaded file: /uploads/52793a923[254](https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/-/jobs/2693418656#L254)287f9f8b93604d0ad0f6/webcomponents.umd.js
2022-07-07T20:06:49.524Z semantic-release:gitlab Create a release for git tag 'v1.0.0-beta.4' with commit '84b3d9bcfb6955619ade6981ec019e70e9e79bc1'
2022-07-07T20:06:49.525Z semantic-release:gitlab POST-ing the following JSON to https://gitlab.com/api/v4/projects/govbr-ds%2Fdev%2Fwbc%2Fgovbr-ds-wbc/releases:
{
  "tag_name": "v1.0.0-beta.4",
  "description": "## [1.0.0-beta.4](https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2022-07-07)\n\n\n### Bug Fixes\n\n* corrige a pub. de release do gitlab ([527b2d2](https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/commit/527b2d23b218bd93c04ac2b3bd35736e133624ab))\n\n",
  "assets": {
    "links": [
      {
        "url": "https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/-/blob/main/README.md"
      },
      {
        "name": "webcomponents.css",
        "url": "https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/uploads/95125aec2df36573b44c74757027066b/webcomponents.css"
      },
      {
        "name": "webcomponents.umd.min.js",
        "url": "https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/uploads/c94864688058ceb1b8cb07536[269](https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/-/jobs/2693418656#L269)60ef/webcomponents.umd.min.js"
      },
      {
        "name": "webcomponents.common.js",
        "url": "https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/uploads/938987bc9c82e014fa6153e55e472e56/webcomponents.common.js"
      },
      {
        "name": "webcomponents.umd.js",
        "url": "https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/uploads/5[279](https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/-/jobs/2693418656#L279)3a923254287f9f8b93604d0ad0f6/webcomponents.umd.js"
      }
    ]
  }
}
[8:06:49 PM] [semantic-release] [@semantic-release/gitlab] › ✖  An error occurred while making a request to the GitLab release API:
HTTPError: Response code 400 (Bad Request)
    at Request.<anonymous> (/builds/govbr-ds/dev/wbc/govbr-ds-wbc/node_modules/got/dist/source/as-promise/index.js:118:42)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1657224409527,
    socket: 1657224409527,
    lookup: 1657224409528,
    connect: 1657224409539,
    secureConnect: 1657224409552,
    upload: 1657224409552,
    response: 1657224409675,
    end: 1657224409675,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 0,
      dns: 1,
      tcp: 11,
      tls: 13,
      request: 0,
      firstByte: 123,
      download: 0,
      total: 148
    }
  }
}
[8:06:49 PM] [semantic-release] › ✖  Failed step "publish" of plugin "@semantic-release/gitlab"
[8:06:49 PM] [semantic-release] › ✖  An error occurred while running semantic-release: HTTPError: Response code 400 (Bad Request)
    at Request.<anonymous> (/builds/govbr-ds/dev/wbc/govbr-ds-wbc/node_modules/got/dist/source/as-promise/index.js:118:42)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1657224409527,
    socket: 1657224409527,
    lookup: 1657224409528,
    connect: 1657224409539,
    secureConnect: 1657224409552,
    upload: 1657224409552,
    response: 1657224409675,
    end: 1657224409675,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 0,
      dns: 1,
      tcp: 11,
      tls: 13,
      request: 0,
      firstByte: 123,
      download: 0,
      total: 148
    }
  },
  pluginName: '@semantic-release/gitlab'
}
HTTPError: Response code 400 (Bad Request)
    at Request.<anonymous> (/builds/govbr-ds/dev/wbc/govbr-ds-wbc/node_modules/got/dist/source/as-promise/index.js:118:42)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1657224409527,
    socket: 1657224409527,
    lookup: 1657224409528,
    connect: 1657224409539,
    secureConnect: 1657224409552,
    upload: 1657224409552,
    response: 1657224409675,
    end: 1657224409675,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 0,
      dns: 1,
      tcp: 11,
      tls: 13,
      request: 0,
      firstByte: 123,
      download: 0,
      total: 148
    }
  },
  pluginName: '@semantic-release/gitlab'
}

.releaserc

{
  "branches": [
    "main",
    {
      "name": "semantic-beta",
      "prerelease": "beta"
    },
    {
      "name": "^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)-beta",
      "prerelease": "beta"
    },
    {
      "name": "^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)-alpha",
      "prerelease": "alpha"
    }
  ],
  "plugins": [
    [
      "@semantic-release/commit-analyzer",
      {
        "preset": "conventionalcommits"
      }
    ],
    [
      "@semantic-release/release-notes-generator",
      {
        "preset": "conventionalcommits",
        "parserOpts": {
          "noteKeywords": [
            "BREAKING CHANGE",
            "BREAKING CHANGES",
            "BREAKING"
          ]
        },
        "writerOpts": {
          "commitsSort": [
            "subject",
            "scope"
          ]
        }
      }
    ],
    "@semantic-release/changelog",
    [
      "@semantic-release/git",
      {
        "assets": [
          "package.json",
          "CHANGELOG.md"
        ],
        "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
      }
    ],
    [
      "@semantic-release/gitlab",
      {
        "assets": [
          {
            "path": "dist/**/*.js"
          },
          {
            "path": "dist/**/*.css"
          },
          {
            "url": "https://gitlab.com/govbr-ds/dev/wbc/govbr-ds-wbc/-/blob/main/README.md"
          }
        ]
      }
    ]
  ]
}

I've tried not using glob pattern for assets, changing my GITLAB_TOKEN and using the GITLAB_URL and GITLAB_PREFIX (currently not using) but neither have helped.

Related issues: #158, #239

@kaerbr
Copy link
Contributor

kaerbr commented Jul 8, 2022

The problem here is that you have to set an label/name for an url asset. Have a look into this comment: #393 (comment)

There already is a PR for automatic taking the name from the given URL (: (#401)

@oliveirarafa
Copy link
Author

oliveirarafa commented Jul 8, 2022

The problem here is that you have to set an label/name for an url asset. Have a look into this comment: #393 (comment)

There already is a PR for automatic taking the name from the given URL (: (#401)

It solved my problem! Thank you.

Just noticed that i got a "HTTPError: Response code 429 (Too Many Requests)". Apparently the API got called many times to fetch MRs. Strange. Got to investigate. But thank you very much for your help.

Edit: Well, It was just the "successComment" that I hadn't noticed in the documentaion. Fixed.

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

No branches or pull requests

2 participants