diff --git a/infra/Makefile b/infra/Makefile index a14f2d1..e9d535b 100644 --- a/infra/Makefile +++ b/infra/Makefile @@ -72,6 +72,7 @@ API_SUBDOMAIN ?= api deploy-local-backfill deploy-aws-backfill \ update-local-backfill update-aws-backfill \ run-local-backfill run-aws-backfill \ + logs-aws-backfill \ sync-site build-site deploy-site invalidate-site list-invalidations serve-local local aws \ update-local-site update-local \ update-iframely-sri @@ -96,6 +97,7 @@ help: @echo " deploy-aws-backfill - Build, upload, and deploy backfill Lambda stack to AWS" @echo " run-local-backfill - Upload dids.txt to LocalStack trigger bucket (DIDS_FILE=...)" @echo " run-aws-backfill - Upload dids.txt to AWS trigger bucket (DIDS_FILE=...)" + @echo " logs-aws-backfill - Tail the most recent backfill Lambda CloudWatch log stream" @echo " build-site - Build the SPA with VITE_API_DID/VITE_API_URL derived from DOMAIN_NAME" @echo " deploy-site - Build, sync, and invalidate CloudFront cache (requires DOMAIN_NAME, AWS_PROFILE)" @echo " invalidate-site - Invalidate CloudFront cache for the site distribution" @@ -623,6 +625,18 @@ run-aws-backfill: $(DIDS_FILE) s3://$(BACKFILL_TRIGGER_BUCKET)/$(BACKFILL_DIDS_S3_KEY) @echo "✅ Upload complete — backfill Lambda triggered" +logs-aws-backfill: + @echo "📋 Fetching latest backfill Lambda logs..." + @# head -1: --output text with --max-items appends a pagination NextToken line ("None") after the result + @STREAM=$$(aws logs describe-log-streams --profile $${AWS_PROFILE} --region $${AWS_REGION} \ + --log-group-name /aws/lambda/backfill \ + --order-by LastEventTime --descending --max-items 1 \ + --query 'logStreams[0].logStreamName' --output text | head -1) && \ + aws logs get-log-events --profile $${AWS_PROFILE} --region $${AWS_REGION} \ + --log-group-name /aws/lambda/backfill \ + --log-stream-name "$$STREAM" \ + --query 'events[].message' --output text + build-site: @[ -n "$(DOMAIN_NAME)" ] || (echo "❌ DOMAIN_NAME is required (e.g. make build-site DOMAIN_NAME=example.com)."; exit 1) VITE_API_URL=$(VITE_API_URL) VITE_API_DID=$(API_DID) pnpm --dir .. build