awspilot / cli-lambda-deploy

MIT License
21 stars 9 forks source link

Types seem to be outdated #7

Open LuisEnMarroquin opened 2 years ago

LuisEnMarroquin commented 2 years ago

I am writting a very simple TypeScript HTTP API behind API Gateway

import { APIGatewayProxyHandler } from "aws-lambda"

export const myFunction: APIGatewayProxyHandler = async (event) => {
  console.log('event', event)
  console.log(event.rawQueryString) // Property 'rawQueryString' does not exist on type 'APIGatewayProxyEvent'
}

It says that rawQueryString doesn't exist

image

But when I log event I see that it exists in CloudWatch

{
  version: '2.0',
  routeKey: 'GET /',
  rawPath: '/',
  rawQueryString: 'xdddd=1223&xyyyyy=5667',
  headers: {
    accept: '*/*',
    'accept-encoding': 'gzip, deflate, br',
    'content-length': '0',
    host: 'api.example.com',
    'x-forwarded-for': 'XXX.XXX.XXX.XXX',
    'x-forwarded-port': '443',
    'x-forwarded-proto': 'https'
  },
  queryStringParameters: { xdddd: '1223', xyyyyy: '5667' },
  requestContext: {
    accountId: '123451234512',
    apiId: '35453sdfs354',
    domainName: 'api.example.com',
    domainPrefix: 'api',
    http: {
      method: 'GET',
      path: '/',
      protocol: 'HTTP/1.1',
      sourceIp: 'XXX.XXX.XXX.XXX',
      userAgent: 'PostmanRuntime/7.28.4'
    },
    requestId: 'XXXXXXXXXXXXX',
    routeKey: 'GET /',
    stage: '$default',
    time: '28/Apr/2022:17:07:28 +0000',
    timeEpoch: 16541656384673
  },
  isBase64Encoded: false
}
astuyve commented 1 year ago

Hi @LuisEnMarroquin and anyone else stumbling into this issue.

This library is a CLI tool for deploying AWS Lambda functions, it is NOT @types/aws-lambda.

In that case, you'll want to remove this library and install the correct one