tfsaggregator / tfsaggregator-webhooks

WARNING: the team is no more maintaing this version. See aggreggator-cli instead.
https://github.com/tfsaggregator/aggregator-cli
19 stars 22 forks source link

Authentication fails against VSTS #22

Closed DanielBMann9000 closed 5 years ago

DanielBMann9000 commented 6 years ago

Starting a few days ago, a client had the Aggregator start to fail against their VSTS account. I was able to track down the root cause to a "404" error when trying to connect back to VSTS with the URLs scraped from the JSON generated by the service hooks.

I identified the problem: The URI parsing logic strips off everything up to and including the _api part of the URI. In the case of VSTS, this now includes the Team Project GUID. As a result, trying to authenticate to that as though it was the Team Project Collection URI results in a 404 error.

Fixed in PR #21.

mihtr commented 6 years ago

I am seeing a similar issue with "work item created" event. I get Status Code: 500. The "work item update" event still works.

How do i update the current azure appservice running the service with the newest build fixing this issue? Do i have to redeploy a new box or is the a script to deploy the latest version on the box?

Looking in the in the log file: 2018-03-15T06:32:22 PID[5920] Error [Critical] 00.068 dfb13329-3301-406f-b217-32b285669b17 Exception encountered processing notification: TF31002: Unable to connect to this Team Foundation Server: https://nxax7.visualstudio.com/8225915f-3591-4127-90ab-08c907f970d9/. Team Foundation Server Url: https://nxax7.visualstudio.com/8225915f-3591-4127-90ab-08c907f970d9/.

Possible reasons for failure include:

Technical information (for administrator): The remote server returned an error: (404) Not Found. Stack Trace: at Microsoft.TeamFoundation.Client.TfsConnection.EnsureProviderConnected() at Aggregator.Core.Facade.WorkItemRepository..ctor(IRuntimeContext context) at Aggregator.WebHooks.Controllers.WorkItemController.<>c.b__1_1(IRuntimeContext runtimeContext) at Aggregator.Core.Context.RuntimeContext.CreateWorkItemRepository() at Aggregator.Core.Context.RuntimeContext.get_WorkItemRepository() at Aggregator.Core.EventProcessor..ctor(IRuntimeContext runtime) at Aggregator.WebHooks.Controllers.WorkItemController.Post(JObject payload) Inner Exception: The remote server returned an error: (404) Not Found. Stack Trace: at System.Net.HttpWebRequest.GetResponse() at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequestAndGetResponse(HttpWebRequest webRequest, WebException& webException)

andrew-seatonpartners commented 6 years ago

I've got the same this with the work item created - has anyone resolved it yet?

giuliov commented 6 years ago

The develop branch, i.e. v2.4.0-RC1 contains a fix. You need to build locally as it breaks Azure CI.

mihtr commented 6 years ago

Do i need to deploy a new instance to update the tfsaggregator-webhook appservice or can I update it? I can not find any information on how to update the appservice with the newest build from Git. @giuliov can you help?

giuliov commented 6 years ago

@mihtr assuming that you deployed tfsaggregator-webhook in Azure as an App Service, then the answer is yes, you can update it How is more complicated. Sketchy, you have to disconnect the current deploy and setup a Continuous Delivery pipeline in the App Service blade

mihtr commented 6 years ago

Thank you @giuliov . I can build and deploy 2.4.0-rc1 using VS, but will have to wait until you build 2.4.0 and the I can sync using deployment options in Azure portal. Is there a expected release date for 2.4.0? TIA

jdshkolnik commented 6 years ago

I'm also hitting this problem.

jessehouwing commented 6 years ago

If anyone has a PR that fixes the Azure deploy button then we can release. Currently stumped by what's not working there.

On Tue, 8 May 2018, 18:48 John D. Shkolnik, notifications@github.com wrote:

I'm also hitting this problem.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tfsaggregator/tfsaggregator-webhooks/issues/22#issuecomment-387467887, or mute the thread https://github.com/notifications/unsubscribe-auth/AD-uS75zbO8LL86FTvRRsFk7VN6S7jdIks5twcxqgaJpZM4SqeNu .

hdamanhoury commented 6 years ago

I tried deploying the develop branch to Azure but I get the following error:

D:\home\site\repository\Aggregator.WebHooks\Aggregator.WebHooks.csproj(74,64): error MSB4066: The attribute "Version" in element is unrecognized. Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\Aggregator.WebHooks\Aggregator.WebHooks.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d5b71f4a9b77f8";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository.\" An error has occurred during web site deployment. \r\nD:\Program Files (x86)\SiteExtensions\Kudu\73.10504.3390\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

giuliov commented 6 years ago

MSBuild 14 matches Visual Studio 2015: we switched to Visual Studio 2017 a while ago

hdamanhoury commented 6 years ago

I built it locally and deployed it so now I have the develop branch running, but I'm still getting a 404:

2018-05-11T10:35:39 PID[12980] Verbose [Verbose] 494.191 pre-request-parsing User 'vsts' authenticated 2018-05-11T10:35:39 PID[12980] Verbose [Verbose] 493.400 27646e0e-b520-4d2b-9411-bba7524947cd Connecting to https://smartframeworkdev.visualstudio.com/c24e8fdf-85ad-418c-bbf0-40b7090eb17b/ impersonating PersonalAuthenticationToken, running as test-vstsaggregator 2018-05-11T10:35:40 PID[12980] Error [Critical] 00.674 e06ea187-bfbe-475e-918d-834f4ed9e7b3 Exception encountered processing notification: TF31002: Unable to connect to this Team Foundation Server: https://smartframeworkdev.visualstudio.com/c24e8fdf-85ad-418c-bbf0-40b7090eb17b/. Team Foundation Server Url: https://smartframeworkdev.visualstudio.com/c24e8fdf-85ad-418c-bbf0-40b7090eb17b/.

Possible reasons for failure include:

Technical information (for administrator): The remote server returned an error: (404) Not Found. Stack Trace: at Microsoft.TeamFoundation.Client.TfsConnection.EnsureProviderConnected() at Aggregator.Core.Facade.WorkItemRepository..ctor(IRuntimeContext context) at Aggregator.WebHooks.Controllers.WorkItemController.<>c.b__1_1(IRuntimeContext runtimeContext) at Aggregator.Core.Context.RuntimeContext.CreateWorkItemRepository() at Aggregator.Core.Context.RuntimeContext.get_WorkItemRepository() at Aggregator.Core.EventProcessor..ctor(IRuntimeContext runtime) at Aggregator.WebHooks.Controllers.WorkItemController.Post(JObject payload) Inner Exception: The remote server returned an error: (404) Not Found. Stack Trace: at System.Net.HttpWebRequest.GetResponse() at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequestAndGetResponse(HttpWebRequest webRequest, WebException& webException)

giuliov commented 6 years ago

As Jesse wrote 3 days ago, Kudu does not work with our project anymore. Currently you must build locally using Visual Studio Community or so and publish to an IIS site, like Azure Web App.

giuliov commented 6 years ago

We have a few ideas in the work to offer a better experience but we need some time to test them.

hdamanhoury commented 6 years ago

@giuliov That's what I did. I downloaded the develop branch, built it locally and published it to an Azure Web App through Visual Studio. However the develop branch doesn't seem to solve the 404 issue.

MaseyBoy commented 6 years ago

Hi. What is the status of this problem please? Is the recommended solution still to build the develop branch and deploy manually to Azure?

Thanks

raistlin-ht commented 6 years ago

I'm new to TFS Aggregator and spent a large chunk of yesterday getting things set up and running only to run into this issue.

I followed the directions as specified at - https://tfsaggregator.github.io/admin/install-webhooks/

Is there a proven work around to properly get authentication working? And if not, any sort of timetable when you expect to have a solution?

giuliov commented 6 years ago

@raistlin-ht I am really surprised that you were able to deploy: as far as I know I does not work for the develop branch (just checked) and the master branch is not working anymore with VSTS.

My current suggestion is to build and deploy the develop branch yourself using Visual Studio.

I hope to find the time in the next weeks to find a solution for deployment and update both code and documentation. Contributions are welcomed.

jdshkolnik commented 6 years ago

I built and deployed the develop branch but am getting this:

Status Code: 500
Reason Phrase: Internal Server Error
HTTP Version: 1.1
Headers:
{
  Pragma: no-cache
  Cache-Control: no-cache
  Date: Wed, 27 Jun 2018 02:59:09 GMT
  Set-Cookie: ARRAffinity=e3a8761ce3056497006ce92f995ddcf6bb4651f4a55edeef03442174d6d35b37;Path=/;HttpOnly;Domain=tfsaggregator-webhooks93z7.azurewebsites.net
  Server: Microsoft-IIS/10.0
  X-AspNet-Version: 4.0.30319
  X-Powered-By: ASP.NET
  Content-Length: 36
  Content-Type: application/json; charset=utf-8
  Expires: -1
}
giuliov commented 6 years ago

Have you checked the instructions in the admin pages? We explain configuration, logging and troubleshooting. The version in the develop branch looks for many conditions in the incoming message or the configuration so I expect that you can find an explicit error somewhere.

If you want a more interactive support, join the Slack workspace (time-zone permitting).

mihtr commented 6 years ago

I did the following to fix the issue.

  1. download webhooks master zip
  2. build solution.
  3. change build version to 2.2.0.2
  4. apply code change to Aggregator.WebHooks/Models/WorkItemRequest.cs from https://github.com/tfsaggregator/tfsaggregator-webhooks/pull/21/files
  5. build solution.
  6. Login into azure portal for app service.
  7. Start Kudo from development tools --> advanced tools.
  8. Open CMD and goto folder D:\home\site\wwwroot\bin
  9. drag'n'drop files from your local build bin folder to bin
  10. restart app services.
  11. check D:\home\LogFiles\Application> for log file and check version build number.