dune-release icon indicating copy to clipboard operation
dune-release copied to clipboard

dune-release: [ERROR] Could not retrieve release ID from response, unexpected Github API error: "Not Found"

Open shonfeder opened this issue 3 years ago • 9 comments

I'm receiving the titular error on version 1.4.0 and

uname -a
Linux comp 5.4.89-1-MANJARO #1 SMP PREEMPT Tue Jan 12 23:39:44 UTC 2021 x86_64 GNU/Linux
[sf@comp emojitsu]$ dune-release publish -vv
dune-release: [INFO] dune-release 1.4.0 running
dune-release: [INFO] Parsing opam file emojitsu.opam
[-] Skipping documentation publication for package emojitsu: no doc field in emojitsu.opam
[-] Publishing distribution
dune-release: [EXEC:115057] ['git' 'rev-parse' '--git-dir']
dune-release: [EXEC:115058] ['git' '--git-dir' '.git' '--work-tree' './'
                             'describe' '--always' 'HEAD']
[-] Publishing to github
dune-release: [EXEC:115059] ['git' 'rev-parse' '--git-dir']
dune-release: [EXEC:115060] ['git' '--git-dir' '.git' '--work-tree' './'
                             'describe' '--always' 'HEAD']
dune-release: [EXEC:115061] ['git' 'rev-parse' '--git-dir']
dune-release: [EXEC:115062] ['git' '--git-dir' '.git' '--work-tree' './'
                             'describe' '--always' 'HEAD']
dune-release: [EXEC:115063] ['git' 'rev-parse' '--git-dir']
dune-release: [EXEC:115064] ['git' '--git-dir' '.git' 'rev-parse' '--verify'
                             '0.0.2']
dune-release: [EXEC:115065] ['git' 'rev-parse' '--git-dir']
dune-release: [EXEC:115066] ['git' 'rev-parse' '--git-dir']
dune-release: [EXEC:115067] ['git' '--git-dir' '.git' '--work-tree' './'
                             'describe' '--always' 'HEAD']
dune-release: [EXEC:115068] ['git' '--git-dir' '.git' 'rev-parse' '--verify'
                             '0.0.2']
[?] Push tag 0.0.2 to [email protected]:shonfeder/emojitsu.git? [Y/n]
Y
[-] Pushing tag 0.0.2 to [email protected]:shonfeder/emojitsu.git
dune-release: [EXEC:115069] ['git' '--git-dir' '.git' 'push' '--force'
                             '[email protected]:shonfeder/emojitsu.git' '0.0.2']
[?] Create release 0.0.2 on [email protected]:shonfeder/emojitsu.git? [Y/n]
Y
[-] Creating release 0.0.2 on [email protected]:shonfeder/emojitsu.git via github's API
dune-release: [ERROR] Could not retrieve release ID from response, unexpected Github API error: "Not Found"

I've also tried pinning master, and am getting the same result, but with a more verbose logging:

[sf@comp emojitsu]$ dune-release publish -vv
dune-release: [INFO] dune-release 1.4.0-140-g5384dff2f7 running
dune-release: [INFO] Parsing opam file emojitsu.opam
[-] Skipping documentation publication for package emojitsu: no doc field in emojitsu.opam
[-] Publishing distribution
[-] Publishing to github
dune-release: [EXEC:116031] ['git' 'rev-parse' '--git-dir']
dune-release: [EXEC:116032] ['git' '--git-dir' '.git' '--work-tree' './'
                             'describe' '--always' 'HEAD']
dune-release: [EXEC:116033] ['git' 'rev-parse' '--git-dir']
dune-release: [EXEC:116034] ['git' '--git-dir' '.git' 'rev-parse' '--verify'
                             '0.0.2']
dune-release: [EXEC:116035] ['git' 'rev-parse' '--git-dir']
dune-release: [EXEC:116036] ['git' '--git-dir' '.git' 'rev-parse' '--verify'
                             '0.0.2']
dune-release: [EXEC:116037] ['git' '--git-dir' '.git' 'rev-parse' '--verify'
                             '0.0.2^0']
dune-release: [EXEC:116038] ['git' '--git-dir' '.git' 'ls-remote' '--quiet'
                             '--tags'
                             'https://github.com/shonfeder/emojitsu.git'
                             '0.0.2']
dune-release: [EXEC:116042] ['git' '--git-dir' '.git' 'rev-parse' '--verify'
                             'ee7f8e78fc320cb2142e6cd91a3a80150da47268^0']
[-] The tag 0.0.2 is present and uptodate on the remote: skipping the tag push
[?] Create release 0.0.2 on https://github.com/shonfeder/emojitsu.git? [Y/n]
Y
[-] Creating release 0.0.2 on https://github.com/shonfeder/emojitsu.git via github's API
dune-release: [DEBUG] [curl] executing request: { meth=POST;
                      url="https://api.github.com/repos/shonfeder/emojitsu/releases";
                      headers=""; body="" }
dune-release: [DEBUG] [curl] with args: --user
                      shonfeder:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

                      --location --silent --show-error --config -
                      --dump-header - --data
                      {"tag_name":"0.0.2","name":"0.0.2","body":"CHANGES:\n\n- Reduce dependency footprint\n"}
dune-release: [DEBUG] [curl] response received: {code=404;
                      headers=x-github-request-id: 8518:0AC4:874F6:17E0DB:601DBCCF

x-github-request-id: 8518:0AC4:874F6:17E0DB:601DBCCF

vary: Accept-Encoding, Accept, X-Requested-With

vary: Accept-Encoding, Accept, X-Requested-With

content-security-policy: default-src 'none'

content-security-policy: default-src 'none'

referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin

referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin

x-xss-protection: 1; mode=block

x-xss-protection: 1; mode=block

x-content-type-options: nosniff

x-content-type-options: nosniff

x-frame-options: deny

x-frame-options: deny

strict-transport-security: max-age=31536000; includeSubdomains; preload

strict-transport-security: max-age=31536000; includeSubdomains; preload

access-control-allow-origin: *

access-control-allow-origin: *

access-control-expose-headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset

access-control-expose-headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset

x-ratelimit-used: 6

x-ratelimit-used: 6

x-ratelimit-reset: 1612564629

x-ratelimit-reset: 1612564629

x-ratelimit-remaining: 54

x-ratelimit-remaining: 54

x-ratelimit-limit: 60

x-ratelimit-limit: 60

x-github-media-type: github.v3; format=json

x-github-media-type: github.v3; format=json

content-length: 117

content-length: 117

content-type: application/json; charset=utf-8

content-type: application/json; charset=utf-8

date: Fri, 05 Feb 2021 21:46:55 GMT

date: Fri, 05 Feb 2021 21:46:55 GMT

server: GitHub.com

HTTP/2 404 
server: GitHub.com
;
body="
{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest/reference/repos#create-a-release"
}
"}
dune-release: [ERROR] Github API error:
    Could not retrieve release ID from response
    Github API returned: "Not Found"
    See the documentation "https://docs.github.com/rest/reference/repos#create-a-release" that might help you resolve this error.

I tried with the same token using github's hub CLI, and it worked fine, so it does seem to be an issue with the request that's being sent to the GitHub API.

shonfeder avatar Feb 05 '21 21:02 shonfeder

This is highly disturbing since the error suggests that the URL to the API endpoint is wrong but I just tested it myself and it seems to be valid as I'm able to gather the list of releases from it. According to the logs above, the tag was indeed there so it's not that either, even though I'd expect a different error message if the tag_name was not properly specified.

Indeed if the token was wrong you'd get a different error so something else must be going on here but I'm struggling to see what that could be. Were you able to reproduce this behaviour multiple times? Are you still running into this error if you try releasing with dune-release on that repo or on another one?

NathanReb avatar Feb 08 '21 09:02 NathanReb

I'm getting the same error. Downgrading to 1.3.3 I get this extra message (not that the release was created):

{
                        "url":
                      "https://api.github.com/repos/LPCIC/elpi/releases/37804553",
                        "assets_url":
                      "https://api.github.com/repos/LPCIC/elpi/releases/37804553/assets",
                        "upload_url":
                      "https://uploads.github.com/repos/LPCIC/elpi/releases/37804553/assets{?name,label}",
                        "html_url":
                      "https://github.com/LPCIC/elpi/releases/tag/v1.13.0",
                        "id": 37804553,

The ID is there.

gares avatar Feb 09 '21 14:02 gares

Hi, do you also get the same issue with the master version?

gpetiot avatar Feb 09 '21 15:02 gpetiot

Hi, do you also get the same issue with the master version?

Hi :) Yes, I am getting the same error on master:

$ dune-release --version
1.4.0-140-g5384dff2f7

I just confirmed it's still happening.

Were you able to reproduce this behaviour multiple times? Are you still running into this error if you try releasing with dune-release on that repo or on another one?

@NathanReb, indeed, this is happening every single time. Just reconfirmed now. All the releases on this repo are the result of using github's hub CLI tool.

I just confirmed this is happening on another repo as well, on a freshly pinned reinstall of master.

shonfeder avatar Feb 10 '21 02:02 shonfeder

I don't have any 404 with this url, I know you've tried the github cli with the same token, but maybe the token file that is used by dune-release is ill-formatted, not so long ago I had a similar issue because there was no linebreak after the token in that file, maybe you have the same issue.

gpetiot avatar Feb 10 '21 12:02 gpetiot

Many thanks for the tip @gpetiot!

Solution:

I deleted the githuhub.token file and reran the publish command. dune-release then prompted me to enter my token. Apparently this fixed whatever the error had been in the formatting (I tried adding a newline manually first, but that didn't fix it), and the release went through successfully! :tada:

It would be helpful to add some validation to the token formatting, if that's at all possible. But I think I wouldn't have hit this in the first place if the features proposed in #339 where in place to fix expired credentials, so I'll close this under the assumption those additions will address the root cause (human error ;)).

shonfeder avatar Feb 11 '21 00:02 shonfeder

Indeed the 404 must be a security feature so that you can't use the API to discover private repositories to which you don't have access to, I'm just a bit surprised it showed up for a public repo here.

Other users ran into this issue where a previously valid token wouldn't work anymore and where refreshing it in dune-release would solve the issue. It might be the case that we broke the token de.serialization.

NathanReb avatar Feb 11 '21 15:02 NathanReb

I did quite struggle with this too, in the end only a new token + using master + entering the token via the console did work [all other choices resulted in strange errors]

The bizarre thing is that I did print the curl call that dune-release was doing, and when I did run it manually the release was properly created.

ejgallego avatar Feb 12 '21 21:02 ejgallego

OK! It sounds like something might be up then, worthy of keeping this issue open until we can resolve the root cause.

shonfeder avatar Feb 13 '21 17:02 shonfeder