From 24def9ad6beb7dcd6d416e16cadc98897374b6f9 Mon Sep 17 00:00:00 2001 From: Cibin Mathew <10793628+cibinmathew@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:56:20 +0200 Subject: [PATCH] Replace failing grep with builtin query Fixes: https://github.com/aws/aws-sam-cli/issues/5940 Script was failing for MacOS's default grep command --- .../{{cookiecutter.project_name}}/deploy_frontend.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nodejs18.x/full-stack/{{cookiecutter.project_name}}/deploy_frontend.sh b/nodejs18.x/full-stack/{{cookiecutter.project_name}}/deploy_frontend.sh index e50c37941..c7f0487bb 100755 --- a/nodejs18.x/full-stack/{{cookiecutter.project_name}}/deploy_frontend.sh +++ b/nodejs18.x/full-stack/{{cookiecutter.project_name}}/deploy_frontend.sh @@ -37,8 +37,7 @@ npm run build && cd dist/ aws s3 sync . s3://$s3_bucket_name/ # Create cloudfront invalidation and capture id for next step -invalidation_output=$(aws cloudfront create-invalidation --distribution-id $cloudfront_distribution_id --paths "/*") -invalidation_id=$(echo "$invalidation_output" | grep -oP '(?<="Id": ")[^"]+') +invalidation_id=$(aws cloudfront create-invalidation --distribution-id $cloudfront_distribution_id --paths "/*" --query "Invalidation.Id" --output text) # Wait for cloudfront invalidation to complete aws cloudfront wait invalidation-completed --distribution-id $cloudfront_distribution_id --id $invalidation_id