title: unable to presigned the uploaded file with serverless node js api issue
body: <p>unable to presigned-url the uploaded file with serverless node js API issue, it generally happens in the us-east-2 region any idea?</p>
  <pre><code>const AWS = require('aws-sdk');
  
  const ID = 'some-id';
  
  const SECRET = 'some-key';
  
  let credentials ={
      accessKeyId: ID,
      secretAccessKey: SECRET,
  }
  
  AWS.config.update({
      credentials : credentials,
      endpoint: 's3-us-east-2.amazonaws.com',
      signatureVersion: 'v4',
      region: 'us-east-2'
    });
  
  module.exports.upload_file = async (event, context, callback) =&gt; {
    const region= 'us-east-2', bucket= 'tt' ;
  
    if (!region || !bucket) {
      throw new Error('REGION and BUCKET environment variables are required!');
    }
  
    let file_name = event.queryStringParameters.file_name
  
      let ext = file_name.split('.').pop().toLowerCase();
  
      let content_type = '';
  
      switch(ext) {
        case 'png':
          content_type = 'image/png';
          break;
        case 'jpg':
          content_type = 'image/jpeg';
          break;      
        case 'json':
          content_type = 'application/json';
          break;
        case 'ai':
          content_type = 'application/postscript';
          break;
         case 'pdf':
          content_type = 'application/pdf';
          break;
        default:
          content_type = 'text/plain';
          break;
      }
      console.debug(&quot;file_name: &quot; + file_name + &quot; content_type: &quot; + content_type)
  
    const S3 = new AWS.S3({ signatureVersion: 'v4', region : region});
    
  
  
    if (!file_name) {
      return {
        statusCode: 400,
        body: JSON.stringify({
          message: 'Missing file_name in  request.',
        }),
      };
    }
  
    const params = {
      Bucket: bucket,
      Key: file_name,
      ContentType: content_type,
      Expires: 30,
    };
  
    try {
      const url = await S3.getSignedUrl('putObject', params);
  
      callback(null,  {
        statusCode: 200,
        headers: {
          'Access-Control-Allow-Origin': '*', // Required for CORS support to work
          'Access-Control-Allow-Credentials': true, // Required for cookies, authorization headers with HTTPS
        },
        body: JSON.stringify(url),
      });
    } catch (error) {
      callback(null, { 
        statusCode: 400,
        body: JSON.stringify(error),
      });
    }
  };
  </code></pre>
  <p>unable to presigned-url s3 bucket the uploaded file with serverless node js api issue</p>
  <p>Error says:</p>
  <blockquote>
  <p>The request signature we calculated does not match the signature you provided. Check your key and signing method.</p>
  </blockquote>