title: request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method error in bots
body: <p>We are creating the bots using Amazon.Lex API which is part of aws-sdk-net, this bots interacts with Amazon lex model. On executing this bot we are getting below mentioned error.</p>
  
  <p><strong>There are other questions exists in SO with the same issue, but those are not related to aws lex sdk.</strong> </p>
  
  <pre><code>    Amazon.Runtime.AmazonUnmarshallingException was unhandled
    HResult=-2146233088
    Message=Error unmarshalling response back from AWS. Request ID: XXXXXXXXXXXXXX, Response Body: &lt;InvalidSignatureException&gt;
    &lt;Message&gt;The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
  
  The Canonical String for this request should have been
  'POST
  /bot/OrderFlowers/alias/user/text
  
  content-type:application/x-amz-json-1.1
  host:runtime.lex.us-east-1.amazonaws.com
  user-agent:aws-sdk-dotnet-45/3.3.1.6 aws-sdk-dotnet-core/3.3.14.1 .NET_Runtime/4.0 .NET_Framework/4.0 OS/Microsoft_Windows_NT_6.2.9200.0 ClientSync
  x-amz-content-sha256:
  x-amz-date:20170605T120548Z
  
  content-type;host;user-agent;x-amz-content-sha256;x-amz-date'
  
  The String-to-Sign should have been
  'AWS4-HMAC-SHA256
  20170605T120548Z
  20170605/us-east-1/lex/aws4_request'
  &lt;/Message&gt;
  &lt;/InvalidSignatureException&gt;
  
    RequestId=
    ResponseBody=&lt;InvalidSignatureException&gt;
    &lt;Message&gt;The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
  
  The Canonical String for this request should have been
  'POST
  /bot/OrderFlowers/alias/user/text
  
  content-type:application/x-amz-json-1.1
  host:runtime.lex.us-east-1.amazonaws.com
  user-agent:aws-sdk-dotnet-45/3.3.1.6 aws-sdk-dotnet-core/3.3.14.1 .NET_Runtime/4.0 .NET_Framework/4.0 OS/Microsoft_Windows_NT_6.2.9200.0 ClientSync
  x-amz-content-sha256:
  x-amz-date:20170605T120548Z
  
  content-type;host;user-agent;x-amz-content-sha256;x-amz-date
  
  
  The String-to-Sign should have been
  'AWS4-HMAC-SHA256
  20170605T120548Z
  20170605/us-east-1/lex/aws4_request
  '
  &lt;/Message&gt;
  &lt;/InvalidSignatureException&gt;
  
    Source=AWSSDK.Core
    StackTrace:
         at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException(IExecutionContext executionContext, HttpErrorResponseException exception) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\HttpErrorResponseExceptionHandler.cs:line 111
         at Amazon.Runtime.Internal.ExceptionHandler`1.Handle(IExecutionContext executionContext, Exception exception) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\ExceptionHandler.cs:line 38
         at Amazon.Runtime.Internal.ErrorHandler.ProcessException(IExecutionContext executionContext, Exception exception) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\ErrorHandler.cs:line 204
         at Amazon.Runtime.Internal.ErrorHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\ErrorHandler.cs:line 78
         at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
         at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 45
         at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
         at Amazon.Runtime.Internal.Signer.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\Signer.cs:line 38
         at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
         at Amazon.Runtime.Internal.CredentialsRetriever.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CredentialsRetriever.cs:line 72
         at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
         at Amazon.Runtime.Internal.RetryHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\RetryHandler\RetryHandler.cs:line 84
         at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
         at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 45
         at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
         at Amazon.Runtime.Internal.EndpointResolver.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\EndpointResolver.cs:line 34
         at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
         at Amazon.Runtime.Internal.Marshaller.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\Marshaller.cs:line 37
         at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
         at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 45
         at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
         at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\ErrorCallbackHandler.cs:line 44
         at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\PipelineHandler.cs:line 55
         at Amazon.Runtime.Internal.MetricsHandler.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\MetricsHandler.cs:line 40
         at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(IExecutionContext executionContext) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\RuntimePipeline.cs:line 135
         at Amazon.Runtime.AmazonServiceClient.Invoke[TRequest,TResponse](TRequest request, IMarshaller`2 marshaller, ResponseUnmarshaller unmarshaller) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\AmazonServiceClient.cs:line 192
         at Amazon.Lex.AmazonLexClient.PostText(PostTextRequest request) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Services\Lex\Generated\_bcl45\AmazonLexClient.cs:line 508
         at AWSLexClient.Program.Main(String[] args) in D:\Sameer\Practice\Bots\AWSLexClient\AWSLexClient\Program.cs:line 30
         at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
         at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()
    InnerException: 
         HResult=-2146232000
         LineNumber=0
         LinePosition=0
         Message=Root element is missing.
         Source=System.Xml
         SourceUri=""
         StackTrace:
              at System.Xml.XmlTextReaderImpl.Throw(Exception e)
              at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
              at System.Xml.XmlTextReaderImpl.Read()
              at Amazon.Runtime.Internal.Transform.XmlUnmarshallerContext.Read() in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Internal\Transform\UnmarshallerContext.cs:line 368
              at Amazon.Runtime.Internal.Transform.ErrorResponseUnmarshaller.Unmarshall(XmlUnmarshallerContext context) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Internal\Transform\ErrorResponseUnmarshaller.cs:line 36
              at Amazon.Runtime.Internal.Transform.JsonErrorResponseUnmarshaller.Unmarshall(JsonUnmarshallerContext context) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Internal\Transform\JsonErrorResponseUnmarshaller.cs:line 41
              at Amazon.Lex.Model.Internal.MarshallTransformations.PostTextResponseUnmarshaller.UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Services\Lex\Generated\Model\Internal\MarshallTransformations\PostTextResponseUnmarshaller.cs:line 110
              at Amazon.Runtime.Internal.Transform.JsonResponseUnmarshaller.UnmarshallException(UnmarshallerContext input, Exception innerException, HttpStatusCode statusCode) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Internal\Transform\ResponseUnmarshallers.cs:line 198
              at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException(IExecutionContext executionContext, HttpErrorResponseException exception) in E:\JenkinsWorkspaces\v3-trebuchet-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\HttpErrorResponseExceptionHandler.cs:line 78
         InnerException: 
  </code></pre>
  
  <p>We implemented the following code</p>
  
  <pre><code>    AWSCredentials credentials = new BasicAWSCredentials("xxxxxxxxxx", "xxxxxxxxxxxxxxxxxx");
  
      AmazonLexClient client = new AmazonLexClient(credentials, new AmazonLexConfig {
          ServiceURL = "https://runtime.lex.us-east-1.amazonaws.com",
          DisableLogging = false,
          #region proxy setting
          ProxyCredentials = new NetworkCredential("xxxxxx","XXXXXX")
          #endregion
      });
  
      var response= client.PostText(new PostTextRequest()
      {
          BotAlias = "",
          BotName = "OrderFlowers",
          InputText = "I would like to pick up flowers",
          UserId = ""
      });
  
      Console.WriteLine("{0}-{1}", response.HttpStatusCode.ToString(), response.Message);
      Console.ReadKey();
  </code></pre>
  
  <p><strong>Note the version of the framework:</strong></p>
  
  <blockquote>
    <p>"AWSSDK.Core" version="3.3.14.1" targetFramework="net45"</p>
    
    <p>"AWSSDK.Lex" version="3.3.1.6" targetFramework="net45" </p>
  </blockquote>
  
  <p>We took following steps before write this code</p>
  
  <p>1) Create User and Group in IAM</p>
  
  <p>2) Associated the following permission to group
   AmazonLexRunBotsOnly, AmazonAPIGatewayInvokeFullAccess,AmazonLexReadOnly,
  AmazonLexFullAccess, AmazonLexRunBotsOnly,AdministratorAccess</p>
  
  <p>3) Added the user to this group.</p>
  
  <hr>
  
  <p>We need your help to resolve this issue. Also please note we have removed access keys and other confidential data.</p>
  
  <p>Thanks.</p>