Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure DevOps webhook 401 unauthorized error #2736

Closed
gaom25 opened this issue Nov 28, 2022 · 7 comments · Fixed by #2809
Closed

Azure DevOps webhook 401 unauthorized error #2736

gaom25 opened this issue Nov 28, 2022 · 7 comments · Fixed by #2809
Labels
bug Something isn't working provider/azuredevops

Comments

@gaom25
Copy link

gaom25 commented Nov 28, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

I have a problem connection atlantis with azure devops, basically when I try the webhook it says 401 unauthorized error, let me explain the whole set up and configuration that I did:

Reproduction Steps

I create a webhook in azure devops with all permission just to test, lets call this string WEB_TOKEN
I use ngrok to test the deployment in local, for that I use ngrok image and atlantis image(ghcr.io/runatlantis/atlantis:latest )
I use the env vars of
ATLANTIS_ATLANTIS_URL= ngrok url
ATLANTIS_AZUREDEVOPS_USER = my account in azure devops with the whole email [email protected]
ATLANTIS_AZUREDEVOPS_TOKEN = the value of WEB_TOKEN
ATLANTIS_AZUREDEVOPS_WEBHOOK_USER = the same email for azure devops user env var
ATLANTIS_AZUREDEVOPS_WEBHOOK_PASSWORD = the password for the user of azure devops
ATLANTIS_REPO_ALLOWLIST = * (just for test)
Then when I want to create the webhook in azure devops I set the values:
URL = the url of ngrok with /events at the end
username = the username [email protected]
password = the same password of the user and is the same as ATLANTIS_AZUREDEVOPS_WEBHOOK_PASSWORD

Logs

When I try the webhook the request reaches atlantis but it fails with 401 respons as image
Also, it shows an error message "ValidatePayload authentication failed"

{"level":"warn","ts":"2022-11-28T22:24:41.292Z","caller":"logging/simple_logger.go:161","msg":"ValidatePayload authentication failed","json":{},"stacktrace":"github.com/runatlantis/atlantis/server/logging.(*StructuredLogger).Log\n\tgithub.jparrowsec.cn/runatlantis/atlantis/server/logging/simple_logger.go:161\ngithub.jparrowsec.cn/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).respond\n\tgithub.jparrowsec.cn/runatlantis/atlantis/server/controllers/events/events_controller.go:710\ngithub.jparrowsec.cn/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).handleAzureDevopsPost\n\tgithub.jparrowsec.cn/runatlantis/atlantis/server/controllers/events/events_controller.go:263\ngithub.jparrowsec.cn/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).Post\n\tgithub.jparrowsec.cn/runatlantis/atlantis/server/controllers/events/events_controller.go:135\nnet/http.HandlerFunc.ServeHTTP\n\tnet/http/server.go:2109\ngithub.jparrowsec.cn/gorilla/mux.(*Router).ServeHTTP\n\tgithub.jparrowsec.cn/gorilla/[email protected]/mux.go:210\ngithub.jparrowsec.cn/urfave/negroni.Wrap.func1\n\tgithub.jparrowsec.cn/urfave/[email protected]/negroni.go:46\ngithub.jparrowsec.cn/urfave/negroni.HandlerFunc.ServeHTTP\n\tgithub.jparrowsec.cn/urfave/[email protected]/negroni.go:29\ngithub.jparrowsec.cn/urfave/negroni.middleware.ServeHTTP\n\tgithub.jparrowsec.cn/urfave/[email protected]/negroni.go:38\ngithub.jparrowsec.cn/runatlantis/atlantis/server.(*RequestLogger).ServeHTTP\n\tgithub.jparrowsec.cn/runatlantis/atlantis/server/middleware.go:70\ngithub.jparrowsec.cn/urfave/negroni.middleware.ServeHTTP\n\tgithub.jparrowsec.cn/urfave/[email protected]/negroni.go:38\ngithub.jparrowsec.cn/urfave/negroni.(*Recovery).ServeHTTP\n\tgithub.jparrowsec.cn/urfave/[email protected]/recovery.go:193\ngithub.jparrowsec.cn/urfave/negroni.middleware.ServeHTTP\n\tgithub.jparrowsec.cn/urfave/[email protected]/negroni.go:38\ngithub.jparrowsec.cn/urfave/negroni.(*Negroni).ServeHTTP\n\tgithub.jparrowsec.cn/urfave/[email protected]/negroni.go:96\nnet/http.serverHandler.ServeHTTP\n\tnet/http/server.go:2947\nnet/http.(*conn).serve\n\tnet/http/server.go:1991"}

image

Environment details

  • Atlantis version: v0.21.0
  • docker version: 20.10.21
  • docker compose version: v2.12.2
  • ngrok version: wernight/ngrok:latest
@gaom25 gaom25 added the bug Something isn't working label Nov 28, 2022
@gaom25
Copy link
Author

gaom25 commented Nov 29, 2022

Today I try with no @org in the username and get this error

atlantis-atlantis-1  | 2022/11/29 19:42:48 PANIC: runtime error: index out of range [1] with length 1
atlantis-atlantis-1  | goroutine 28 [running]:
atlantis-atlantis-1  | github.com/urfave/negroni.(*Recovery).ServeHTTP.func1()
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/recovery.go:159 +0xc7
atlantis-atlantis-1  | panic({0x16351c0, 0xc0001bf5c0})
atlantis-atlantis-1  | 	runtime/panic.go:884 +0x212
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsRepo(0xc000572000, 0xc0005b4180)
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/events/event_parser.go:927 +0x616
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsPull(_, _)
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/events/event_parser.go:874 +0x2bb
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsPullEvent(_, {{0xc000a9f560, 0x24}, 0x23, {0xc000a9f590, 0x24}, {0xc0001bee40, 0x17}, {0xc0002f9e80, 0xc0002f9e90, ...}, ...})
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/events/event_parser.go:805 +0x165
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).HandleAzureDevopsPullRequestEvent(0xc000a1c000, {0x7f49fd7118f8, 0xc000122320}, 0xc00014c9a0, {0xc0005a76c0, 0x3e})
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:678 +0x2d5
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).handleAzureDevopsPost(0xc000a1c000, {0x7f49fd7118f8, 0xc000122320}, 0xc00020e400)
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:280 +0x270
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).Post(0xc000a1c000, {0x7f49fd7118f8, 0xc000122320}, 0xc00020e400)
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:135 +0x232
atlantis-atlantis-1  | net/http.HandlerFunc.ServeHTTP(0xc00020e300?, {0x7f49fd7118f8?, 0xc000122320?}, 0x676b19?)
atlantis-atlantis-1  | 	net/http/server.go:2109 +0x2f
atlantis-atlantis-1  | github.com/gorilla/mux.(*Router).ServeHTTP(0xc000141080, {0x7f49fd7118f8, 0xc000122320}, 0xc00020e000)
atlantis-atlantis-1  | 	github.com/gorilla/[email protected]/mux.go:210 +0x1cf
atlantis-atlantis-1  | github.com/urfave/negroni.Wrap.func1({0x7f49fd7118f8, 0xc000122320}, 0x153a420?, 0xc0001b8140)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:46 +0x4b
atlantis-atlantis-1  | github.com/urfave/negroni.HandlerFunc.ServeHTTP(0x30?, {0x7f49fd7118f8?, 0xc000122320?}, 0xc000693800?, 0x7f49fda39e30?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:29 +0x33
atlantis-atlantis-1  | github.com/urfave/negroni.middleware.ServeHTTP({{0x1b0af60?, 0xc000544a08?}, 0xc000544a50?}, {0x7f49fd7118f8, 0xc000122320}, 0x3?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:38 +0xb6
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server.(*RequestLogger).ServeHTTP(0xc0000502c0, {0x7f49fd7118f8, 0xc000122320}, 0xc00020e000, 0xc0001b8100)
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/middleware.go:70 +0x485
atlantis-atlantis-1  | github.com/urfave/negroni.middleware.ServeHTTP({{0x1b066a0?, 0xc0000502c0?}, 0xc000544a38?}, {0x7f49fd7118f8, 0xc000122320}, 0x7f49fd906040?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:38 +0xb6
atlantis-atlantis-1  | github.com/urfave/negroni.(*Recovery).ServeHTTP(0xc000076800?, {0x7f49fd7118f8?, 0xc000122320?}, 0x7f49fd7118f8?, 0xc000693a48?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/recovery.go:193 +0x86
atlantis-atlantis-1  | github.com/urfave/negroni.middleware.ServeHTTP({{0x1b07620?, 0xc0002389b0?}, 0xc000544a20?}, {0x7f49fd7118f8, 0xc000122320}, 0x700d26?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:38 +0xb6
atlantis-atlantis-1  | github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc000a1f3e0, {0x1b11720?, 0xc00014c8c0}, 0x6f1ed4?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:96 +0x125
atlantis-atlantis-1  | net/http.serverHandler.ServeHTTP({0x1b0ec50?}, {0x1b11720, 0xc00014c8c0}, 0xc00020e000)
atlantis-atlantis-1  | 	net/http/server.go:2947 +0x30c
atlantis-atlantis-1  | net/http.(*conn).serve(0xc000185d60, {0x1b12808, 0xc0008bc2a0})
atlantis-atlantis-1  | 	net/http/server.go:1991 +0x607
atlantis-atlantis-1  | created by net/http.(*Server).Serve
atlantis-atlantis-1  | 	net/http/server.go:3102 +0x4db
atlantis-atlantis-1  | 2022/11/29 19:42:48 http: panic serving 172.19.0.3:34162: runtime error: invalid memory address or nil pointer dereference
atlantis-atlantis-1  | goroutine 28 [running]:
atlantis-atlantis-1  | net/http.(*conn).serve.func1()
atlantis-atlantis-1  | 	net/http/server.go:1850 +0xbf
atlantis-atlantis-1  | panic({0x14b3e00, 0x2543a70})
atlantis-atlantis-1  | 	runtime/panic.go:890 +0x262
atlantis-atlantis-1  | github.com/urfave/negroni.(*Recovery).ServeHTTP.func1()
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/recovery.go:166 +0x23c
atlantis-atlantis-1  | panic({0x16351c0, 0xc0001bf5c0})
atlantis-atlantis-1  | 	runtime/panic.go:884 +0x212
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsRepo(0xc000572000, 0xc0005b4180)
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/events/event_parser.go:927 +0x616
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsPull(_, _)
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/events/event_parser.go:874 +0x2bb
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsPullEvent(_, {{0xc000a9f560, 0x24}, 0x23, {0xc000a9f590, 0x24}, {0xc0001bee40, 0x17}, {0xc0002f9e80, 0xc0002f9e90, ...}, ...})
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/events/event_parser.go:805 +0x165
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).HandleAzureDevopsPullRequestEvent(0xc000a1c000, {0x7f49fd7118f8, 0xc000122320}, 0xc00014c9a0, {0xc0005a76c0, 0x3e})
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:678 +0x2d5
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).handleAzureDevopsPost(0xc000a1c000, {0x7f49fd7118f8, 0xc000122320}, 0xc00020e400)
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:280 +0x270
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).Post(0xc000a1c000, {0x7f49fd7118f8, 0xc000122320}, 0xc00020e400)
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:135 +0x232
atlantis-atlantis-1  | net/http.HandlerFunc.ServeHTTP(0xc00020e300?, {0x7f49fd7118f8?, 0xc000122320?}, 0x676b19?)
atlantis-atlantis-1  | 	net/http/server.go:2109 +0x2f
atlantis-atlantis-1  | github.com/gorilla/mux.(*Router).ServeHTTP(0xc000141080, {0x7f49fd7118f8, 0xc000122320}, 0xc00020e000)
atlantis-atlantis-1  | 	github.com/gorilla/[email protected]/mux.go:210 +0x1cf
atlantis-atlantis-1  | github.com/urfave/negroni.Wrap.func1({0x7f49fd7118f8, 0xc000122320}, 0x153a420?, 0xc0001b8140)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:46 +0x4b
atlantis-atlantis-1  | github.com/urfave/negroni.HandlerFunc.ServeHTTP(0x30?, {0x7f49fd7118f8?, 0xc000122320?}, 0xc000693800?, 0x7f49fda39e30?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:29 +0x33
atlantis-atlantis-1  | github.com/urfave/negroni.middleware.ServeHTTP({{0x1b0af60?, 0xc000544a08?}, 0xc000544a50?}, {0x7f49fd7118f8, 0xc000122320}, 0x3?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:38 +0xb6
atlantis-atlantis-1  | github.com/runatlantis/atlantis/server.(*RequestLogger).ServeHTTP(0xc0000502c0, {0x7f49fd7118f8, 0xc000122320}, 0xc00020e000, 0xc0001b8100)
atlantis-atlantis-1  | 	github.com/runatlantis/atlantis/server/middleware.go:70 +0x485
atlantis-atlantis-1  | github.com/urfave/negroni.middleware.ServeHTTP({{0x1b066a0?, 0xc0000502c0?}, 0xc000544a38?}, {0x7f49fd7118f8, 0xc000122320}, 0x7f49fd906040?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:38 +0xb6
atlantis-atlantis-1  | github.com/urfave/negroni.(*Recovery).ServeHTTP(0xc000076800?, {0x7f49fd7118f8?, 0xc000122320?}, 0x7f49fd7118f8?, 0xc000693a48?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/recovery.go:193 +0x86
atlantis-atlantis-1  | github.com/urfave/negroni.middleware.ServeHTTP({{0x1b07620?, 0xc0002389b0?}, 0xc000544a20?}, {0x7f49fd7118f8, 0xc000122320}, 0x700d26?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:38 +0xb6
atlantis-atlantis-1  | github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc000a1f3e0, {0x1b11720?, 0xc00014c8c0}, 0x6f1ed4?)
atlantis-atlantis-1  | 	github.com/urfave/[email protected]/negroni.go:96 +0x125
atlantis-atlantis-1  | net/http.serverHandler.ServeHTTP({0x1b0ec50?}, {0x1b11720, 0xc00014c8c0}, 0xc00020e000)
atlantis-atlantis-1  | 	net/http/server.go:2947 +0x30c
atlantis-atlantis-1  | net/http.(*conn).serve(0xc000185d60, {0x1b12808, 0xc0008bc2a0})
atlantis-atlantis-1  | 	net/http/server.go:1991 +0x607
atlantis-atlantis-1  | created by net/http.(*Server).Serve
atlantis-atlantis-1  | 	net/http/server.go:3102 +0x4db

The only difference between yesterday and today is the update of the image

@acostaedg
Copy link

Facing the same issue with atlantis versions 0.20 and 0.21, is there any solution already?

2022/12/02 14:27:36 PANIC: runtime error: index out of range [1] with length 1
goroutine 72 [running]:
github.com/urfave/negroni.(*Recovery).ServeHTTP.func1()
github.com/urfave/[email protected]/recovery.go:159 +0xc7
panic({0x13bce00, 0xc0003a6bd0})
runtime/panic.go:884 +0x212
github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsRepo(0xc0001cf9a0, 0xc000880e00)
github.com/runatlantis/atlantis/server/events/event_parser.go:929 +0x676
github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsPull(, )
github.com/runatlantis/atlantis/server/events/event_parser.go:874 +0x2bb
github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsPullEvent(
, {{0xc0002fb530, 0x24}, 0x6, {0xc0002fb560, 0x24}, {0xc0003a6318, 0x17}, {0xc0003f44f0, 0xc0003f4500, ...}, ...})
github.com/runatlantis/atlantis/server/events/event_parser.go:805 +0x165
github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).HandleAzureDevopsPullRequestEvent(0xc0000c31e0, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc0001107e0, {0xc0007ec2c0, 0x3e})
github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:667 +0x2d5
github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).handleAzureDevopsPost(0xc0000c31e0, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc0002cc700)
github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:275 +0x270
github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).Post(0xc0000c31e0, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc0002cc700)
github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:135 +0x232
net/http.HandlerFunc.ServeHTTP(0xc0002cc600?, {0x7f2b165b40b8?, 0xc0000a27a8?}, 0x671a19?)
net/http/server.go:2109 +0x2f
github.com/gorilla/mux.(*Router).ServeHTTP(0xc000112c00, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc0002cc500)
github.com/gorilla/[email protected]/mux.go:210 +0x1cf
github.com/urfave/negroni.Wrap.func1({0x7f2b165b40b8, 0xc0000a27a8}, 0x12edc00?, 0xc0002d2d80)
github.com/urfave/[email protected]/negroni.go:46 +0x4b
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0x30?, {0x7f2b165b40b8?, 0xc0000a27a8?}, 0xc000028800?, 0x7f2b167f93b8?)
github.com/urfave/[email protected]/negroni.go:29 +0x33
github.com/urfave/negroni.middleware.ServeHTTP({{0x16fa980?, 0xc0000109d8?}, 0xc000010df8?}, {0x7f2b165b40b8, 0xc0000a27a8}, 0x3?)
github.com/urfave/[email protected]/negroni.go:38 +0xb6
github.com/runatlantis/atlantis/server.(*RequestLogger).ServeHTTP(0xc0000a9e80, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc0002cc500, 0xc0002d2d40)
github.com/runatlantis/atlantis/server/middleware.go:70 +0x485
github.com/urfave/negroni.middleware.ServeHTTP({{0x16f7500?, 0xc0000a9e80?}, 0xc000010de0?}, {0x7f2b165b40b8, 0xc0000a27a8}, 0x7f2b167f7f00?)
github.com/urfave/[email protected]/negroni.go:38 +0xb6
github.com/urfave/negroni.(*Recovery).ServeHTTP(0xc00005cc00?, {0x7f2b165b40b8?, 0xc0000a27a8?}, 0xc000028a48?, 0xc000028a48?)
github.com/urfave/[email protected]/recovery.go:193 +0x86
github.com/urfave/negroni.middleware.ServeHTTP({{0x16f7f40?, 0xc0001a5d60?}, 0xc000010ca8?}, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc000372a00?)
github.com/urfave/[email protected]/negroni.go:38 +0xb6
github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc0005b92c0, {0x17006c0?, 0xc000110700}, 0x6faa74?)
github.com/urfave/[email protected]/negroni.go:96 +0x125
net/http.serverHandler.ServeHTTP({0x16fde48?}, {0x17006c0, 0xc000110700}, 0xc0002cc500)
net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc000428960, {0x1701390, 0xc0007ea180})
net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
net/http/server.go:3102 +0x4db
2022/12/02 14:27:36 http: panic serving 10.124.76.6:33910: runtime error: invalid memory address or nil pointer dereference
goroutine 72 [running]:
net/http.(*conn).serve.func1()
net/http/server.go:1850 +0xbf
panic({0x1277e00, 0x1f6df90})
runtime/panic.go:890 +0x262
github.com/urfave/negroni.(*Recovery).ServeHTTP.func1()
github.com/urfave/[email protected]/recovery.go:166 +0x23c
panic({0x13bce00, 0xc0003a6bd0})
runtime/panic.go:884 +0x212
github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsRepo(0xc0001cf9a0, 0xc000880e00)
github.com/runatlantis/atlantis/server/events/event_parser.go:929 +0x676
github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsPull(
, )
github.com/runatlantis/atlantis/server/events/event_parser.go:874 +0x2bb
github.com/runatlantis/atlantis/server/events.(*EventParser).ParseAzureDevopsPullEvent(
, {{0xc0002fb530, 0x24}, 0x6, {0xc0002fb560, 0x24}, {0xc0003a6318, 0x17}, {0xc0003f44f0, 0xc0003f4500, ...}, ...})
github.com/runatlantis/atlantis/server/events/event_parser.go:805 +0x165
github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).HandleAzureDevopsPullRequestEvent(0xc0000c31e0, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc0001107e0, {0xc0007ec2c0, 0x3e})
github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:667 +0x2d5
github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).handleAzureDevopsPost(0xc0000c31e0, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc0002cc700)
github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:275 +0x270
github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).Post(0xc0000c31e0, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc0002cc700)
github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:135 +0x232
net/http.HandlerFunc.ServeHTTP(0xc0002cc600?, {0x7f2b165b40b8?, 0xc0000a27a8?}, 0x671a19?)
net/http/server.go:2109 +0x2f
github.com/gorilla/mux.(*Router).ServeHTTP(0xc000112c00, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc0002cc500)
github.com/gorilla/[email protected]/mux.go:210 +0x1cf
github.com/urfave/negroni.Wrap.func1({0x7f2b165b40b8, 0xc0000a27a8}, 0x12edc00?, 0xc0002d2d80)
github.com/urfave/[email protected]/negroni.go:46 +0x4b
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0x30?, {0x7f2b165b40b8?, 0xc0000a27a8?}, 0xc000028800?, 0x7f2b167f93b8?)
github.com/urfave/[email protected]/negroni.go:29 +0x33
github.com/urfave/negroni.middleware.ServeHTTP({{0x16fa980?, 0xc0000109d8?}, 0xc000010df8?}, {0x7f2b165b40b8, 0xc0000a27a8}, 0x3?)
github.com/urfave/[email protected]/negroni.go:38 +0xb6
github.com/runatlantis/atlantis/server.(*RequestLogger).ServeHTTP(0xc0000a9e80, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc0002cc500, 0xc0002d2d40)
github.com/runatlantis/atlantis/server/middleware.go:70 +0x485
github.com/urfave/negroni.middleware.ServeHTTP({{0x16f7500?, 0xc0000a9e80?}, 0xc000010de0?}, {0x7f2b165b40b8, 0xc0000a27a8}, 0x7f2b167f7f00?)
github.com/urfave/[email protected]/negroni.go:38 +0xb6
github.com/urfave/negroni.(*Recovery).ServeHTTP(0xc00005cc00?, {0x7f2b165b40b8?, 0xc0000a27a8?}, 0xc000028a48?, 0xc000028a48?)
github.com/urfave/[email protected]/recovery.go:193 +0x86
github.com/urfave/negroni.middleware.ServeHTTP({{0x16f7f40?, 0xc0001a5d60?}, 0xc000010ca8?}, {0x7f2b165b40b8, 0xc0000a27a8}, 0xc000372a00?)
github.com/urfave/[email protected]/negroni.go:38 +0xb6
github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc0005b92c0, {0x17006c0?, 0xc000110700}, 0x6faa74?)
github.com/urfave/[email protected]/negroni.go:96 +0x125
net/http.serverHandler.ServeHTTP({0x16fde48?}, {0x17006c0, 0xc000110700}, 0xc0002cc500)
net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc000428960, {0x1701390, 0xc0007ea180})
net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
net/http/server.go:3102 +0x4db

@nitrocode
Copy link
Member

@acostaedg @gaom25 is this a recent issue or has it always been an issue? Please try a previous stable release and confirm

@acostaedg
Copy link

Hi @nitrocode I already tested versions from v0.18.5 to latest and the issue is there, always the webhook test from Azure DevOps fails.

But, it's important to mention that from actual Pull Requests created, updated, or commented in Azure DevOps repos it works fine. The issue is triggered as I mentioned before, from webhook tests, and also when a comment is removed manually from a Pull Request it appears again.

@nitrocode
Copy link
Member

Ok then to summarize, it seems like this issue may have always been present and this is not a regression which is what was most concerning to me. Please review the code and see where it can be improved or if we need updates to our docs. Most of our maintainers use aws for deployment so we're lacking on azure setups.

@nitrocode nitrocode changed the title Azure DevOps configuration in local test Azure DevOps webhook failure Dec 2, 2022
@nitrocode nitrocode changed the title Azure DevOps webhook failure Azure DevOps webhook 401 unauthorized error Dec 2, 2022
@gaom25
Copy link
Author

gaom25 commented Dec 5, 2022

As @acostaedg said the problem happen with the test button in AzureDevops but when the webhook is applied it works correctly

@nitrocode
Copy link
Member

This may be a duplicate of #2641

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working provider/azuredevops
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants