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

Error 405 (Method Not Allowed) when creating Gitlab release (Gitlab self-hosted) #1102

Closed
NielsCodes opened this issue Apr 30, 2024 · 2 comments

Comments

@NielsCodes
Copy link

I have a new app with a new Gitlab repo and I would like to use release-it, but every time it tries to create a Gitlab release, I get the following error (in verbose mode):

? Create a release on GitLab (Release 0.1.0)? Yes
! gitlab releases#uploadAssets
! gitlab releases#createRelease "Release 0.1.0" (v0.1.0)
ERROR Response code 405 (Method Not Allowed)
 ELIFECYCLE  Command failed with exit code 1.

I have a Gitlab Personal Access Token that even has admin rights, which is configured as GITLAB_TOKEN in my .zshrc. I have also tried creating a new token with the API scope (like the docs say) in the new repo and using that instead, but the result is the same.
I also have full permissions on the repository, so that can't be the cause of the issue either.

Here is my .release-it.json:

{
  "plugins": {
    "@release-it/conventional-changelog": {
      "preset": "angular",
      "infile": "CHANGELOG.md"
    }
  },
  "npm": {
    "publish": false
  },
  "gitlab": {
    "release": true,
    "host": "https://gitlab.mycustomdomain.com/api/v4"
  },
  "git": {
    "commitMessage": "chore: release v${version}",
    "requireCleanWorkingDir": false,
    "tagName": "v${version}",
    "requireUpstream": false
  },
  "before:init": "git fetch --prune --prune-tags origin"
}

I have two other projects that also use release-it with the exact same config and those are working fine.
I cannot for the life of me seem to figure out what is different here.

I'm using version 17.2.0 of release-it and our Gitlab instance is on version v16.10.0-ee

Any help is much appreciated!

@webpro
Copy link
Collaborator

webpro commented May 8, 2024

Maybe some misconfiguration in the local GitLab instance?

Try the NODE_DEBUG prefix and get more logging: https://github.com/release-it/release-it?tab=readme-ov-file#troubleshooting--debugging

@NielsCodes
Copy link
Author

Running it with NODE_DEBUG did indeed tell me the issue:

remote: \n' +
    "remote: Project 'Someone/my-project' was moved to 'development/my-project'.        \n" +
    'remote: \n' +
    'remote: Please update your Git remote:        \n' +
    'remote: \n' +

It turns out that my repo was moved from someone's personal account into a group. The origin will still work for normal fetch and push operations, but any API calls that are not GET methods will be blocked.

All I needed to do in the end was update the Git origin.

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