sbt-dependency-submission icon indicating copy to clipboard operation
sbt-dependency-submission copied to clipboard

Submission result URL is not a valid Github API endpoint - "message": "Not Found" error

Open renxinhe opened this issue 8 months ago • 0 comments

Issue

The submission result is logged as a clickable URL inside the Github action output log on this line:

      state.log.info(s"Submitted successfully as $snapshotUrl/${snapshot.id}")

In reality, $snapshotUrl/${snapshot.id} is not a valid GET request endpoint from the Github API, and clicking on it from the Github action log would always pop up a new window showing the following 404 error:

{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest"
}

This is a very confusing UX for people who are trying to debug a new Github action that uses this package.

Investigation

When I was testing adding this new Github action to my repo, I kept hitting this red herring 404 status. Only when I tried the submission endpoint locally did I discover the real HTTP response. It showed the real reason why my dependency graph wasn't updating even though the snapshot was submitted successfully:

{
    "id": <redacted>,
    "created_at": "2024-05-31T00:11:22.957Z",
    "result": "ACCEPTED",
    "message": "The snapshot was accepted, but it is not for the default branch. It will not update dependency results for the repository."
}

Mitigation suggestion

I recommend not formatting the success message as a clickable URL. Instead, we should log the httpResp response body in getSnapshot even if the status is 2**.

renxinhe avatar May 31 '24 00:05 renxinhe