fix: resolve Lambda invocation failure from API Gateway

- Align Dockerfile with AWS official documentation for provided runtime
- Remove DefinitionBody from SAM template to avoid conflict with Events property
- This enables SAM to automatically generate AWS::Lambda::Permission resource
- Fixes 500 error when Forgejo webhook triggers API Gateway endpoint"
This commit is contained in:
Daisuke Nakahara 2026-01-12 21:25:06 +09:00
parent a59a8e6461
commit 8cd30da394
2 changed files with 1 additions and 25 deletions

View file

@ -13,6 +13,5 @@ FROM public.ecr.aws/lambda/provided:al2023
RUN dnf update -y && \
dnf install -y git zip && \
dnf clean all
COPY --from=build /app/main ${LAMBDA_TASK_ROOT}
WORKDIR ${LAMBDA_TASK_ROOT}
COPY --from=build /app/main ./main
ENTRYPOINT [ "./main" ]

View file

@ -105,29 +105,6 @@ Resources:
Name: blog-deployment-webhook-api
StageName: !Ref StageName
EndpointConfiguration: REGIONAL
DefinitionBody:
openapi: "3.0.1"
info:
title: "Forgejo Webhook API"
version: "1.0"
paths:
/forgejo-webhook:
post:
summary: "Trigger Lambda via Forgejo Webhook"
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyLambdaFunction.Arn}/invocations
httpMethod: POST
type: aws_proxy
responses:
'200':
description: "Successful response"
'400':
description: "Bad Request - Incorrect request payload format"
'401':
description: "Unauthorized - Signature verification failed"
'500':
description: "Server error - Deployment process failed"
Outputs:
ApiEndpoint: