cds icon indicating copy to clipboard operation
cds copied to clipboard

Cannot creat github repository webhook

Open bidandows opened this issue 3 years ago • 1 comments

Hi there,

I am trying to set up a repository webhook on my Github repo, please find the logs I am getting below.

021-03-20 23:43:59 [ERROR] pprofLabel>compress>setRequestID>recoverWrap>handle>postHookHandler>CreateHook: internal server error (caused by: cannot create hook on github for repository emplorium/visitor-service: github.CreateHook. Data : {"id":0,"name":"web","active":true,"events":["push"],"config":{"url":"http://localhost:8080/cdshooks/webhook/42819bbd-669c-4f78-9e92-af27be344c4d","content_type":"json"}}: Unable to create webhook on github. Status code : 404 - Body: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/repos#create-a-repository-webhook"}. ) action=vcs.(*Service).postHookHandler action_metadata_name=github action_metadata_owner=emplorium action_metadata_repo=visitor-service caller=github.com/ovh/cds/engine/service.WriteError deprecated=false handler=vcs.(*Service).postHookHandler method=POST request_id=d635aba2-36cf-44b8-acff-3fafbce92cf3 request_uri=/vcs/github/repos/emplorium/visitor-service/hooks route=/vcs//repos///hooks source_file=/tmp/790ad7b9a1a85167593986ed564384b7/run/engine/service/http.go source_line=124 stack_trace=Unable to create webhook on github. Status code : 404 - Body: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/repos#create-a-repository-webhook"}. github.CreateHook. Data : {"id":0,"name":"web","active":true,"events":["push"],"config":{"url":"http://localhost:8080/cdshooks/webhook/42819bbd-669c-4f78-9e92-af27be344c4d","content_type":"json"}} github.com/ovh/cds/sdk.WrapError /tmp/790ad7b9a1a85167593986ed564384b7/run/sdk/error.go:634 github.com/ovh/cds/engine/vcs/github.(*githubClient).CreateHook /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/vcs/github/client_hook.go:59 github.com/ovh/cds/engine/vcs.(*Service).postHookHandler.func1 /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/vcs/vcs_handlers.go:1026 github.com/ovh/cds/engine/api.(*Router).handle.func1 /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go:435 net/http.HandlerFunc.ServeHTTP /usr/local/go/src/net/http/server.go:2069 github.com/ovh/cds/engine/api.(*Router).recoverWrap.func1 /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go:170 github.com/ovh/cds/engine/api.(*Router).setRequestID.func1 /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go:120 net/http.HandlerFunc.ServeHTTP /usr/local/go/src/net/http/server.go:2069 github.com/gorilla/handlers.CompressHandlerLevel.func1 /go/pkg/mod/github.com/gorilla/[email protected]/compress.go:143 net/http.HandlerFunc.ServeHTTP /usr/local/go/src/net/http/server.go:2069 github.com/ovh/cds/engine/api.(*Router).compress.func1 /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go:95 github.com/ovh/cds/engine/api.(*Router).pprofLabel.func1 /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go:87 net/http.HandlerFunc.ServeHTTP /usr/local/go/src/net/http/server.go:2069 github.com/gorilla/mux.(*Router).ServeHTTP /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:162 net/http.serverHandler.ServeHTTP /usr/local/go/src/net/http/server.go:2887 net/http.(*conn).serve /usr/local/go/src/net/http/server.go:1952 runtime.goexit /usr/local/go/src/runtime/asm_amd64.s:1371 cannot create hook on github for repository emplorium/visitor-service

bidandows avatar Mar 20 '21 23:03 bidandows

Hi, looks like Github is returning a 404 response to CDS VCS service POST call to /repos/emplorium/visitor-service/hooks. I suppose that you successfully setup an application in CDS with this Github repo. Also creating webhook on a repository requires admin right on Github repo so the person who linked github to the CDS project should have admin role on this repository. Can you check that this last point is ok ?

richardlt avatar Mar 25 '21 15:03 richardlt