title: SignatureDoesNotMatch error from S3 putObject
body: <p>I'm using the AWS Javascript SDK to put files to my S3. The following code is intended to upload a user avatar to the S3. I'm hardcoding the accessKeyId and secretAccessKey for now, and taking the file and key for uploading from a web form.</p>
  
  <pre><code> document.getElementById("upload-button").onclick = function() {
       const key = document.getElementById("key-text").value;
       var file = document.getElementById("file-chooser").files[0];
  
       const S3 = new AWS.S3({
        signatureVersion: "v4",
        apiVersion: '2006-03-01',
        accessKeyId: 'ACCESS_KEY_ID',
        secretAccessKey: 'SECRET_ACCESS_KEY',
        region: 'us-west-2'
      })
  
        S3.putObject({
          Key: key,
          Bucket: 'my-bucket-name',
          Body: file,
        }, (err, data) =&gt; {
          if (err) {
            alert("Error: " + err);
          } else {
            alert("Upload successful: " + data);
          }
        })
    }
   document.getElementById("upload-button").onclick = function() {
       const key = document.getElementById("key-text").value;
       var file = document.getElementById("file-chooser").files[0];
  
       const S3 = new AWS.S3({`
        signatureVersion: "v4",
        apiVersion: '2006-03-01',
        accessKeyId: 'ACCESS_KEY_ID',
        secretAccessKey: 'SECRET_ACCESS_KEY',
        region: 'us-west-2'
      })
  
        S3.putObject({
          Key: key,
          Bucket: 'ilarp-data-prod-1',
          Body: file,
        }, (err, data) =&gt; {
          if (err) {
            alert("Error: " + err);
          } else {
            alert("Upload successful: " + data);
          }
        })
    }
  </code></pre>
  
  <p>The code above gives me an error return of SignatureDoesNotMatch I'm mystified by that, since I thought I was letting the API do the signing, and earlier versions of this (which I unfortunately cannot reproduce) did not give me this error.</p>