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

4xx back from github api when using semantic-release/github #80

Closed
skilbjo opened this issue Sep 21, 2021 · 1 comment
Closed

4xx back from github api when using semantic-release/github #80

skilbjo opened this issue Sep 21, 2021 · 1 comment

Comments

@skilbjo
Copy link

skilbjo commented Sep 21, 2021

Hey @cycjimmy , thanks for your action. If you could let me know if this is an issue on my side, the semantic-release-action side, or a downstream breaking change with semantic-release

Describe the bug
This config used to work, it worked as recently as last Thursday (~4 days ago)

Using @semantic-release/github fails with a 4xx from github: 'Invalid name for request "."'

My guess is it might be related to this: semantic-release/github@051659b

semantic-release/github now requires node@14+, but from the stack trace user-agent header below, I see:

 'user-agent': 'octokit-rest.js/18.10.0 octokit-core.js/3.5.1 Node.js/12.13.1 (linux; x64)',

I am requesting node@14 in my checkout action, so unable to explain why the user-agent header is node@12.

Workflow
Github action config:

...

      - uses: actions/setup-node@v2
        with:
          node-version: 14

      - uses: cycjimmy/semantic-release-action@v2
        id: semantic # need an `id` for output variables
        with:
          extra_plugins: |
            @semantic-release/git
            @semantic-release/changelog
            @semantic-release/exec
        env:
          GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
          NPM_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.ACTIONS_TOKEN }}

.releaserc config:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    ["@semantic-release/changelog", {
      "changelogFile": "CHANGELOG.md"
    }],
    ["@semantic-release/github", {
      assets: "dist/*"
    }],
    ["@semantic-release/exec", {
      "verifyConditionsCmd": "make ci",
    }],
    ["@semantic-release/git", {
      "assets": ["CHANGELOG.md"],
      "message": "docs(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
    }]
  ]
}

Stack trace:

[2:16:29 AM] [semantic-release] › ✖  Failed step "publish" of plugin "@semantic-release/github"
[2:16:29 AM] [semantic-release] › ✖  An error occurred while running semantic-release: RequestError [HttpError]: Invalid name for request "."
    at /home/runner/work/_actions/cycjimmy/semantic-release-action/v2/node_modules/@octokit/request/dist-node/index.js:86:21
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  name: 'HttpError',
  status: 400,
  response: {
    url: 'https://uploads.github.com/repos/[redacted]/[redacted]/releases/49951210/assets?name=canary-types.js&',
    status: 400,
    headers: {
      'cache-control': 'no-cache',
      connection: 'close',
      'content-length': '92',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Tue, 21 Sep 2021 02:16:29 GMT',
      'strict-transport-security': 'max-age=31557600',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'x-github-request-id': '0840:16E2:1030B9:150FEA:6140007D',
      'x-xss-protection': '1; mode=block'
    },
    data: {
      message: 'Invalid name for request "."',
      request_id: '0840:16E2:1030B9:150FEA:6140007D',
    }
  },
  request: {
    method: 'POST',
    url: 'https://uploads.github.com/repos/[redacted]/[redacted]/releases/49951210/assets?name=canary-types.js&',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-rest.js/18.10.0 octokit-core.js/3.5.1 Node.js/12.13.1 (linux; x64)',
      'content-type': 'application/javascript',
      'content-length': 403,
      authorization: 'token [REDACTED]'
    },
    body: <Buffer ...... 353 more bytes>,
    request: { agent: undefined, hook: [Function: bound bound register] }
  },
  pluginName: '@semantic-release/github'
}
Error: HttpError: Invalid name for request "."

Expected behavior
No 4xx error from github when using the below config

Additional context

@skilbjo
Copy link
Author

skilbjo commented Sep 22, 2021

@pennywisdom mentioned in #79 to version pin semantic-release/git. That was the fix for me, here is my github-actions config if anyone else has this problem:

      - uses: cycjimmy/semantic-release-action@v2.5.4
        with:
          semantic_version: 17
          extra_plugins: |
            @semantic-release/git@9.0.1
            @semantic-release/changelog@6.0.0
            @semantic-release/exec@6.0.1

additionally, in this package's readme, it mentions:

It is recommended to manually specify a version of semantic-release to prevent errors caused during the official semantic-release upgrade.

so I've taken this as an opportunity to version pin all of the plugins

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

1 participant