question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consistent HTTP 422 errors when publishing assets to GitHub release

See original GitHub issue

👋

We’re using semantic-release/github plugin to publish assets to each release we make with semantic-release.

The release configuration is as follows:

{
  "prepare": [
    "@semantic-release/npm",
    {
      "path": "@semantic-release/exec",
      "cmd": "npm i -g pkg && pkg ."
    }
  ],
  "publish": [
    "@semantic-release/npm",
    {
      "path": "@semantic-release/github",
      "assets": [
        {
          "path": "./snyk-linux",
          "name": "snyk-linux",
          "label": "snyk-linux"
        },
        {
          "path": "./snyk-macos",
          "name": "snyk-macos",
          "label": "snyk-macos"
        },
        {
          "path": "./snyk-win.exe",
          "name": "snyk-win.exe",
          "label": "snyk-win.exe"
        }
      ]
    }
  ]
}

The assets are being published as expected, however the plugin fails over a 422 response from GH:

[06:49:06] [semantic-release] › ✖  An error occurred while running semantic-release: { HttpError: {"message":"Validation Failed","request_id":"AA68:095A:1D9FF3:201218:5B7D0761","documentation_url":"https://developer.github.com/v3","errors":[{"resource":"ReleaseAsset","code":"already_exists","field":"name"}]}
    at response.text.then.message (/home/travis/.nvm/versions/node/v8.11.4/lib/node_modules/semantic-release/node_modules/@octokit/rest/lib/request/request.js:72:19)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  name: 'HttpError',
  code: 422,
  status: undefined,
  headers: 
   { 'cache-control': 'no-cache',
     connection: 'close',
     'content-length': '211',
     'content-security-policy': 'default-src \'none\'',
     'content-type': 'application/json; charset=utf-8',
     date: 'Wed, 22 Aug 2018 06:49:06 GMT',
     'strict-transport-security': 'max-age=31557600',
     'x-accepted-oauth-scopes': 'repo',
     'x-content-type-options': 'nosniff',
     'x-frame-options': 'deny',
     'x-github-media-type': 'github.v3; format=json',
     'x-github-request-id': 'AA68:095A:1D9FF3:201218:5B7D0761',
     'x-oauth-scopes': 'repo',
     'x-xss-protection': '1; mode=block' },
  pluginName: '@semantic-release/github' }
{ HttpError: {"message":"Validation Failed","request_id":"AA68:095A:1D9FF3:201218:5B7D0761","documentation_url":"https://developer.github.com/v3","errors":[{"resource":"ReleaseAsset","code":"already_exists","field":"name"}]}
    at response.text.then.message (/home/travis/.nvm/versions/node/v8.11.4/lib/node_modules/semantic-release/node_modules/@octokit/rest/lib/request/request.js:72:19)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  name: 'HttpError',
  code: 422,
  status: undefined,
  headers: 
   { 'cache-control': 'no-cache',
     connection: 'close',
     'content-length': '211',
     'content-security-policy': 'default-src \'none\'',
     'content-type': 'application/json; charset=utf-8',
     date: 'Wed, 22 Aug 2018 06:49:06 GMT',
     'strict-transport-security': 'max-age=31557600',
     'x-accepted-oauth-scopes': 'repo',
     'x-content-type-options': 'nosniff',
     'x-frame-options': 'deny',
     'x-github-media-type': 'github.v3; format=json',
     'x-github-request-id': 'AA68:095A:1D9FF3:201218:5B7D0761',
     'x-oauth-scopes': 'repo',
     'x-xss-protection': '1; mode=block' },
  pluginName: '@semantic-release/github' }

More details at https://travis-ci.org/snyk/snyk/jobs/419030290

I appreciate the fact this may be on GH side, opened a support ticket with them, will update here once I hear back.

Wanted to document the issue here, maybe there’s more context?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
adrukhcommented, Sep 7, 2018

THANKS for this fix! Sorry I missed your ask for --debug output, can confirm the issue is resolved for us!

0reactions
juanpmarincommented, Aug 22, 2019

@mirismaili did you workaround this ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Content Management API Docs | Contentstack
Contentstack returns the 422 HTTP status code for an error along with the "UID is not valid" message in the response body either...
Read more >
octokit/rest.js
For custom logging, pass an object with debug , info , warn and error methods as ... to grant the access token for...
Read more >
Publishing GitHub Packages returns 422 error - Stack Overflow
I added logs and I can see that the token is read correctly, all the value (GROUP, VERSION, etc) seem correct and that...
Read more >
tools/build/publish | Hex Preview
201 )) then errexit "Creating release in GitHub failed with http code '$curl_rslt'" fi if [[ -z $client_package_file ]] then pinfo 'No release...
Read more >
Zalando RESTful API and Event Guidelines
MUST use official HTTP status codes; MUST specify success and error responses ... By using API semantic version information or API publishing date...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found