title: Using s3 getObject in Lambda function generates url with InvalidToken error
body: <p>I'm trying to get presigned URL to s3 object using getObject method in Lambda function. But result URL displays an InvalidToken error when I open it in browser.</p>
  
  <p>I have uploaded a <code>data.txt</code> file to a bucket.</p>
  
  <p><strong>content.ts</strong></p>
  
  <pre><code>import 'source-map-support/register';
  import { APIGatewayProxyHandler } from 'aws-lambda';
  import { S3 } from 'aws-sdk';
  
  const s3 = new S3({
      signatureVersion: 'v4'
  });
  
  export const getContent: APIGatewayProxyHandler = async (event, context) =&gt; {
      const signedUrl = s3.getSignedUrl('getObject', {
          Bucket: process.env.BUCKET,
          Key: 'data.txt',
          Expires: 60
      });
  
      return {
          statusCode: 200,
          body: JSON.stringify({
              url: signedUrl
          })
      };
  }
  </code></pre>
  
  <p><strong>serverless.yml</strong></p>
  
  <pre><code>service:
    name: purchased-content
  
  custom:
    bucket: "project-paid-content"
  
  plugins:
    - serverless-webpack
  
  provider:
    name: aws
    runtime: nodejs10.x
    region: us-east-2
    iamRoleStatements:
      - Effect: "Allow"
        Action:
         - "s3:GetObject"
        Resource:
          - "arn:aws:s3:::${self:custom.bucket}"
          - "arn:aws:s3:::${self:custom.bucket}/*"
  
  functions:
    getContent:
      handler: content.getContent
      events:
        - http:
            method: get
            path: get
      environment:
        BUCKET: ${self:custom.bucket}
  
  resources:
    Resources:
      PaidContentBucket:
        Type: AWS::S3::Bucket
        Properties:
          BucketName: ${self:custom.bucket}
          AccessControl: Private
  </code></pre>