Closed infiniterecursion closed 2 years ago
Can you validate the data on the outgoing response? If I had to guess one of the values is null.
What would be the best way to go about that? When I send the same request data from TFS using Postman, I do not get the error, only when TFS directly sends the webhook. I'm not generating any data to send back to TFS.
Best way would be to edit the module in the box and log the variables out to see if they are null.
I've tried modifying the RestPS.psm1 file to add either Write-Host output or using the provided Write-Log function but can't seem to get it to output anything. Do I need to reload the module or something? If I copy what was sent from the TFS webhook history menu and paste it into Postman I can send the same data without error. Could it be related to the headers?
Ok, I think I found my issue. It seems I was outputting some variable values for testing and the main module seems to be sending that as the response body to the initiating service. Right now I'm just using a return 0
out of my script, but should there be something else I need to return? The originating service is sending a webhook to the listener so I don't really need to transmit any information back to the originator.
Sorry, I'm not sure I fully understand what's going on.
I think my issue was that I was using a return statement at the end of my processing script but did not realize that Powershell by default will return every variable that you output in a script file when you call a return statement. So the main RestPS wrapper script was expecting me to return one object back to it but I was in fact returning more due to some variables I was trying to output for testing. I think everything is okay now as I've gotten the error to go away by removing the variables I was outputting in my script, but I now have a question about what, if anything, I should be returning back to RestPS as a best practice.
RestPS - you only need to send back the data you want to respond with from the web server, nothing more.
I'm getting the following error when processing webhooks from only certain applications. Not sure what I need to look at to troubleshoot. The incoming data is processed fine, so I think this error may be when attempting to send a response. Could this be a configuration issue with the sending application (Team Foundation Server 2017)?
Exception calling "Write" with "3" argument(s): "The I/O operation has been aborted because of either a thread exit or an application request"