[duplicate] No commit found error for sha from GitHub tag event

Hello,

I just set up drone CI and it works pretty great already. I just have one problem: I can’t seem to build tags. When I push a tag to my GitHub repo I just get an error 500: {"message":"No commit found for the ref 08c98caf3a26e1cbc98000af6156e14d4e0e5171"} (as seen in GitHub’s “Recent Deliveries” for WebHooks. The build for the same tag via travis works just fine.

Hi there,

I run cloud.drone.io and we are not experiencing any issues with tags. I just pushed a tag to verify: https://cloud.drone.io/drone/go-scm/2/1/1

In this case, it appears the GitHub API call to get the commit details for 08c98caf3a26e1cbc98000af6156e14d4e0e5171 returned a Not Found. So I think the question is, why would GitHub return an error when trying to fetch the commit details if the commit exists? Maybe this was a one time internal error within GitHub? Or does this happen every time? Have you considered opening a support request in GitHub to see why the API call failed?

Thanks for the quick reply and thanks for testing it yourself! I guess I’ll poke around this some more and ask the GitHub support if it keeps failing.

Thanks for providing Drone CI, it works pretty great right now :slight_smile:

np, let me know if it keeps happening and what GitHub says. My guess is that maybe they have some sort of eventual consistency on their backend. Generally speaking, Drone will start your build in milliseconds vs travis which could take seconds or maybe even minutes. Perhaps drone is just too fast for GitHub :slight_smile: either way, let me know.

Hi

Since yesterday I’m experimenting the same problem with github.

Github webhooks return the same error:
We couldn’t deliver this payload: **timed out**

While drone returns:
{"commit":"dab3e88c6cfbd31e2c6dbd1fd52208c65db3da44","error":"No commit found for the ref dab3e88c6cfbd31e2c6dbd1fd52208c65db3da44","event":"tag","level":"warning","msg":"trigger: cannot find yaml","ref":"refs/tags/v1.0.1-10","repo":"myrepo","time":"2021-03-26T06:47:12Z"}

Screenshot of github webhooks page:

The first valid commit is the git push after tag update, next one (first which failed) is when I push the tag and the next ones are the manual redeliveries.

Here is the trigger section of my .drone.yml file

trigger:
  event:
    - tag
  ref:
    - refs/tags/*-*

I think it’s not a problem on github because if I redeliver the same webhook through github webhook page, I got the same error few hours later.

On locally cloned repo I can get the good commit id like drone said:

> git show-ref --tags | grep refs/tags/v1.0.1-10
dab3e88c6cfbd31e2c6dbd1fd52208c65db3da44 refs/tags/v1.0.1-10

When I checkout this commit id it works well and I can find the .drone.yml file.

> master  git checkout dab3e88c6cfbd31e2c6dbd1fd52208c65db3da44
Note: switching to 'dab3e88c6cfbd31e2c6dbd1fd52208c65db3da44'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at a9b7d3e 1.0.1-10

> a9b7d3e  la
total 624K
drwxr-xr-x  11 root root 4.0K Mar 15 12:29 dist
-rw-r--r--   1 root root  366 Mar 15 12:26 Dockerfile
-rw-r--r--   1 root root 2.0K Mar 26 08:48 .drone.yml
-rw-r--r--   1 root root 1.7K Mar 15 12:26 env-sample
-rw-r--r--   1 root root  462 Mar 15 12:26 .eslintrc.json
drwxr-xr-x   8 root root 4.0K Mar 26 08:48 .git
-rw-r--r--   1 root root   55 Mar 15 12:26 .gitignore
-rw-r--r--   1 root root  35K Mar 15 12:26 LICENSE
-rw-r--r--   1 root root   60 Mar 15 12:26 .nestcli.json
-rw-r--r--   1 root root  148 Mar 15 12:26 nodemon.json
-rw-r--r--   1 root root 3.0K Mar 26 08:48 package.json
-rw-r--r--   1 root root 486K Mar 26 08:48 package-lock.json
-rw-r--r--   1 root root   51 Mar 15 12:26 .prettierrc
-rw-r--r--   1 root root  177 Mar 15 12:26 README.md
drwxr-xr-x  11 root root 4.0K Mar 26 08:48 src
drwxr-xr-x   2 root root 4.0K Mar 15 12:26 test
-rw-r--r--   1 root root  651 Mar 15 12:26 tsconfig.json
-rw-r--r--   1 root root 1.3K Mar 15 12:26 webpack.config.js

It was the first time it appears while it was running well for 2 weeks now. Since yesterday all my repos have the same problem.
Can I execute more commands to check something ?

Thank you for your help

See this existing thread Timeout error on github webhook. One of our users identifies that GitHub is sending the wrong sha in the webhook. As a result Drone cannot fetch the yaml using the GitHub API. When Drone cannot fetch the yaml it retries multiple times for up to 90 seconds; GitHub only waits for a webhook response for up to 30 seconds. The timeout is not the problem; the problem is that GitHub returns a Not Found when fetching the yaml because the webhook contains an incorrect sha.

Lets move the discussion to Timeout error on github webhook