skip to Main Content

I provided an API for a simple get method and the test with AWS APIGateWay was successful.
However, when requesting with Postman, I get an "Internal server error" error.

index.py

import json

def handler(event, context):
    print('lambda start!!!')

    return {
        'statusCode': 200,
        'body': json.dumps('Hello, world!')
    }

other informations

・Execution role has "AWSLambdaBasicExecutionRole"
 (Checked from resource "aws_iam_role" "main")

・Method request Authorization: NONE

・nothing appears in the Lambda log, the API Gate way log looks like this

  1. (d3d3140c-c3bc-4da5-891c-b686d39bf441) HTTP Method: GET, Resource Path: /test
  2. (d3d3140c-c3bc-4da5-891c-b686d39bf441) Execution failed due to configuration error: Invalid permissions on Lambda function

These are gate way test result.

Latency : 47
Status : 200
Response body : "Hello, world!"
Response headers
{
  "X-Amzn-Trace-Id": "Root=1-65cffacb-bc8319c29a991e0162f40399;Sampled=1;lineage=34df7d2c:0"
}

2

Answers


  1. Chosen as BEST ANSWER

    Because it wasn't deployed.

    I configured this APY using Terraform like "terraform apply" but it wasn't deployed.So I clicked "deploy API" manually.


  2. Ensure that the execution role assigned to your Lambda function has permissions to be invoked by API Gateway. You can do this by going to the IAM console, finding the role associated with your Lambda function, and attaching the necessary policies. At a minimum, the role should have the AWSLambdaBasicExecutionRole policy attached.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search