huserben / TfsExtensions

Extensions for TFS 2015+ such as custom Widgets (require TFS 2017) and Build Tasks
MIT License
45 stars 22 forks source link

400 Error printed without any help in logs #113

Closed AArnott closed 3 years ago

AArnott commented 5 years ago

The log for the failed task just includes the 400 error code. No logs to reveal the request that was sent or the rest of the response message that explain the error. How can we investigate the failure?

Using current Collection Url |  
  | Server URL: https://devdiv.visualstudio.com/ |  
  | Using Personal Access *** |  
  | Provided team project was guid. |  
  | Error during request (1/5) |  
  | Error message: Error: Failed request: (400) |  
  | Will wait 1 seconds before retrying request... |  
  |  
huserben commented 5 years ago

Hi @AArnott

sorry for the late response, I was on vacation the past weeks and didn't have time to check github.

Does this error happen every time for every build or only in specific scenarios? Did it ever work for you or did it just start to happen one day? Did you ever try to set the debug parameter to true when queueing the build and check the output then?

AArnott commented 5 years ago

It was when I started trying to use your task, so there's no guarantee I was using it properly. In fact after filing this issue I found a mistake which when corrected, made your task function properly. I don't recall exactly what it was -- possibly a bad build id or something.

So I don't think the issue is that your task failed when it should have succeeded. I think rather you can take this as feedback about improving the logging of failures (even when system.debug=false).

huserben commented 5 years ago

Ok, yeah that makes sense, I will have a look into it when I find the time.

However I'm not sure if I'm able to get more detail as I'm using the Microsoft Azure Devops Rest Client Service that is sending the request...anyway in case I manage to reproduce a "wrong" request I will debug into what's available for output to the logs.

Thanks anyway for your input and to contributing to make the task more user friendly.

codyconfer commented 5 years ago

I am having this issue as well, and it seems that it occurred once I added more than one build variable.

I am following the varKey: "varValue", var1Key: "var1Value" syntax, the variables seem to be getting set correctly based on log output, but I cannot for the life of me figure out how to get rid of the 400 errors without being able to see the actual request that is getting sent out.

codyconfer commented 5 years ago

I've blown this task away several times and tried to recreate it, stripping more configurations each time and leaving default values.

I think there may be a deeper issue here.

codyconfer commented 5 years ago
2019-09-09T19:30:57.7888109Z Trying to fetch authentication token from system...
2019-09-09T19:30:57.7895354Z Using OAuth Access Token
2019-09-09T19:30:58.0228588Z Provided team project was guid.
2019-09-09T19:30:58.0229291Z Context is Release - using Release Environment Variables
2019-09-09T19:30:58.0229935Z Build shall be triggered for same user that triggered current Release: Cody Confer
2019-09-09T19:30:58.0230175Z Using same branch as source version: refs/heads/cody/tags
2019-09-09T19:30:58.0231431Z Will fail the task if a condition is not fulfilled.
2019-09-09T19:30:58.1639919Z Error during request (1/5)
2019-09-09T19:30:58.1640121Z Error message: Error: Failed request: (400)
2019-09-09T19:30:58.1640221Z Will wait 1 seconds before retrying request...
2019-09-09T19:30:59.2280132Z Error during request (2/5)
2019-09-09T19:30:59.2281507Z Error message: Error: Failed request: (400)
2019-09-09T19:30:59.2281897Z Will wait 2 seconds before retrying request...
2019-09-09T19:31:01.3054274Z Error during request (3/5)
2019-09-09T19:31:01.3055737Z Error message: Error: Failed request: (400)
2019-09-09T19:31:01.3056176Z Will wait 4 seconds before retrying request...
2019-09-09T19:31:05.3745441Z Error during request (4/5)
2019-09-09T19:31:05.3747462Z Error message: Error: Failed request: (400)
2019-09-09T19:31:05.3747834Z Will wait 8 seconds before retrying request...
2019-09-09T19:31:13.4462486Z Error during request (5/5)
2019-09-09T19:31:13.4463157Z Error message: Error: Failed request: (400)
2019-09-09T19:31:13.4468242Z Will wait 16 seconds before retrying request...
codyconfer commented 5 years ago

finally found it, I had to turn off "Use same source branch as triggered build".

fyi: this option requires that old branches not be deleted if a release is created on a branch other than compare or default. the branch I was keying the broken releases off of was inadvertently deleted at some point.

huserben commented 5 years ago

@codyconfer Thanks for your input, I believe this is (sort of) already captured in the Known Issues.

I currently don't have a lot of spare time to spend on the task, thus the improvements on the logs is still on hold.

I would post an update here in case any new changes are implemented.

brsrom commented 5 years ago

I started getting the same error message out of the blue without any changes in the pipeline, used to work for weeks. Do you have any ideas on how to troubleshoot it?

huserben commented 5 years ago

Hi @brsrom

that is odd, does it happen now all the time or just sporadically? Could I see the logs to check whether something looks odd in terms of configuration?

MisinformedDNA commented 4 years ago

Thanks for your input, I believe this is (sort of) already captured in the Known Issues.

If you mean the second bullet-point, that specifically calls out release pipelines.

image

huserben commented 4 years ago

Hi @MisinformedDNA

Yes, but wasn't the context of the problem a Release? Or did I miss something? :-)

MisinformedDNA commented 4 years ago

I guess I missed that. But I was seeing this same error message in a Build pipeline.

I figured it out. The (YAML) pipeline it was calling didn't exist on the master branch (only in a pull request).