poshbotio / PoshBot

Powershell-based bot framework
MIT License
540 stars 108 forks source link

"CallingUserInfo":null for Teams Backend #229

Closed golubenkoff closed 3 years ago

golubenkoff commented 3 years ago

Hi,

Using PoshBot for Teams and Slack

For most users all is OK, but for some of them - for Teams Backend we getting "CallingUserInfo":null for commands when trying to access/read $global:PoshBotContext.ParsedCommand.CallingUserInfo -that is null for some reason for this users.

and Error in PoshBot.Log: {"DataTime":"2021-04-19 20:30:08Z" ,"Class":"TeamsBackend" ,"Method":"SendTeamsMessaage" ,"Severity":"Error" ,"LogLevel":"Info" ,"Message":"The remote server returned an error: (400) Bad Request." ,"Data":{"CommandName":"Invoke-RestMethod" ,"Message":"The remote server returned an error: (400) Bad Request." ,"TargetObject":{"AllowAutoRedirect":true ,"AllowWriteStreamBuffering":true ,"AllowReadStreamBuffering":false ,"HaveResponse":true ,"KeepAlive":true ,"Pipelined":true ,"PreAuthenticate":false ,"UnsafeAuthenticatedConnectionSharing":false ,"SendChunked":false ,"AutomaticDecompression":0 ,"MaximumResponseHeadersLength":64 ,"ClientCertificates":[] ,"CookieContainer":{"Capacity":300 ,"Count":0 ,"MaxCookieSize":4096 ,"PerDomainCapacity":20} ,"SupportsCookieContainer":true ,"RequestUri":"https://smba.trafficmanager.net/emea/v3/conversations/a:1uNvS4feMuTUXByFucl9XyHBb-E20PBL5XTokbi5tMH56YqOzdssKJpFhwTfP6tBbtFdFx4ojstGNkoLDx3l0UHrsuQQah4B_Ff9Gi-vCZNalY149WI8RN1d/activities/1618864204548" ,"ContentLength":721 ,"Timeout":-1 ,"ReadWriteTimeout":300000 ,"ContinueTimeout":350 ,"Address":"https://smba.trafficmanager.net/emea/v3/conversations/a:1uNvS4feMuTUXByFucl9XyHBb-E20PBL5XTokbi5tMH56YqOzdssKJpFhwTfP6tBbtFdFx4ojstGNkoLDx3l0UHrsuQQah4B_Ff9Gi-vCZNalY149WI8RN1d/activities/1618864204548" ,"ContinueDelegate":null ,"ServicePoint":{"BindIPEndPointDelegate":null ,"ConnectionLeaseTimeout":-1 ,"Address":"http://proxy.mydomain:3128/" ,"MaxIdleTime":100000 ,"UseNagleAlgorithm":true ,"ReceiveBufferSize":-1 ,"Expect100Continue":true ,"IdleSince":"\/Date(1618864135639)\/" ,"ProtocolVersion":{"Major":1 ,"Minor":1 ,"Build":-1 ,"Revision":-1 ,"MajorRevision":-1 ,"MinorRevision":-1} ,"ConnectionName":"http" ,"ConnectionLimit":2 ,"CurrentConnections":5 ,"Certificate":{"Handle":2392146719680 ,"Issuer":"CN=Microsoft RSA TLS CA 01, O=Microsoft Corporation, C=US" ,"Subject":"CN=*.botapi.skype.com"} ,"ClientCertificate":null ,"SupportsPipelining":true} ,"Host":"smba.trafficmanager.net" ,"MaximumAutomaticRedirections":50 ,"Method":"POST" ,"Credentials":null ,"UseDefaultCredentials":false ,"ConnectionGroupName":null ,"Headers":["Authorization" ,"User-Agent" ,"Content-Type" ,"Host" ,"Content-Length" ,"Expect"] ,"Proxy":{"Credentials":{"UserName":"" ,"Password":"" ,"SecurePassword":{"Length":0} ,"Domain":""}} ,"ProtocolVersion":{"Major":1 ,"Minor":1 ,"Build":-1 ,"Revision":-1 ,"MajorRevision":-1 ,"MinorRevision":-1} ,"ContentType":"application/json;charset=utf-8" ,"MediaType":null ,"TransferEncoding":null ,"Connection":null ,"Accept":null ,"Referer":null ,"UserAgent":"Mozilla/5.0 (Windows NT; Windows NT 10.0; en-US) WindowsPowerShell/5.1.17763.1852" ,"Expect":"100-continue" ,"IfModifiedSince":"\/Date(-62135596800000)\/" ,"Date":"\/Date(-62135596800000)\/" ,"ServerCertificateValidationCallback":null ,"CreatorInstance":{} ,"CachePolicy":{"Level":1} ,"AuthenticationLevel":1 ,"ImpersonationLevel":4} ,"Position":"At C:\...\PoshBot\0.14.0\PoshBot.psm1:9861 char:21\r\n+ Invoke-RestMethod @responseParams\r\n+ ~~~~~~~~~" ,"CategoryInfo":"InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException" ,"FullyQualifiedErrorId":"WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand"}}

Poshbot @Windows Server 2019 ( Tested on Win10 - the same ) Windows Powershell 5.1

golubenkoff commented 3 years ago

Team Limitations. Sorry