Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build-lambda-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ jobs:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ vars.ECR_REPOSITORY_LAMBDA }}
AWS_S3_BUCKET_NAME: ${{ vars.AWS_S3_BUCKET }}
CLOUDFRONT_DISTRIBUTION_ID: ${{ vars.CLOUDFRONT_DISTRIBUTION_ID }}
run: |
# Build the Docker image from the 'scripts' directory.
# This assumes your Dockerfile is located in 'scripts/Dockerfile'.
docker buildx build --platform linux/amd64 --provenance=false -f ./scripts/Dockerfile.script --build-arg AWS_S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest ./scripts
docker buildx build --platform linux/amd64 --provenance=false -f ./scripts/Dockerfile.script --build-arg AWS_S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME} --build-arg CLOUDFRONT_DISTRIBUTION_ID=${CLOUDFRONT_DISTRIBUTION_ID} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest ./scripts

# Push the built image to ECR
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
Expand Down
3 changes: 3 additions & 0 deletions scripts/Dockerfile.script
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ WORKDIR /app
ARG AWS_S3_BUCKET_NAME
ENV S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME}

ARG CLOUDFRONT_DISTRIBUTION_ID
ENV CLOUDFRONT_DISTRIBUTION_ID=${CLOUDFRONT_DISTRIBUTION_ID}
Comment on lines +14 to +15
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment variable name mismatch detected. The Dockerfile sets CLOUDFRONT_DISTRIBUTION_ID, but the lambda-handler.ts expects CLOUDFRONT_DISTRIBUTION_NAME. This will cause the Lambda function to fail at runtime with a "Missing CloudFront configuration" error.

Either change the Dockerfile to use CLOUDFRONT_DISTRIBUTION_NAME or update the lambda-handler.ts to read CLOUDFRONT_DISTRIBUTION_ID.

Suggested change
ARG CLOUDFRONT_DISTRIBUTION_ID
ENV CLOUDFRONT_DISTRIBUTION_ID=${CLOUDFRONT_DISTRIBUTION_ID}
ARG CLOUDFRONT_DISTRIBUTION_NAME
ENV CLOUDFRONT_DISTRIBUTION_NAME=${CLOUDFRONT_DISTRIBUTION_NAME}

Copilot uses AI. Check for mistakes.

COPY --from=build /app/dist ./dist
COPY package*.json ./
RUN apt-get update && \
Expand Down
Loading
Loading