awslambdarpc icon indicating copy to clipboard operation
awslambdarpc copied to clipboard

events.APIGatewayProxyRequest no data

Open quycao opened this issue 4 years ago • 1 comments

Hi, Thank you very much for your solution. I have issue when lambda receive event from rpc call. the req events.APIGatewayProxyRequest is empty as below. Hence i cannot get req.HTTPMethod or req.QueryStringParameters.

{ Resource: Path: HTTPMethod: Headers:map[] MultiValueHeaders:map[] QueryStringParameters:map[] MultiValueQueryStringParameters:map[] PathParameters:map[] StageVariables:map[] RequestContext:{ AccountID: ResourceID: OperationName: Stage: DomainName: DomainPrefix: RequestID: Protocol: Identity:{ CognitoIdentityPoolID: AccountID: CognitoIdentityID: Caller: APIKey: APIKeyID: AccessKey: SourceIP: CognitoAuthenticationType: CognitoAuthenticationProvider: UserArn: UserAgent: User: } ResourcePath: Authorizer:map[] HTTPMethod: RequestTime: RequestTimeEpoch:0 APIID: } Body: IsBase64Encoded:false }

Can you please share your sample project for reference and testing purpose?

quycao avatar Dec 09 '20 11:12 quycao

Hello, thanks for your feedback.

These fields are sent to the lambda function as fields in the event JSON, following the events.APIGatewayProxyRequest structure. This means you can pass these parameters as such:

{
  "resource": "/{proxy+}",
  "path": "/path/to/resource",
  "httpMethod": "GET",
  "queryStringParameters": {
    "name": "test"
  },
  "body": "the body is aways a string",
  "headers": {"accept-encoding":"gzip"}
}

blmayer avatar Dec 26 '20 19:12 blmayer

Closing this issue for inactivity.

blmayer avatar Oct 05 '22 03:10 blmayer